bubble sort by tails (%20)

s/.*/compare = 0   swap = 0   data:/
:
s/\<.\>/0&/
${s/\>/-/2
s/\n/<9876543210>/2
/\<\(\(.*\)\(.\)\w*\)<.*\3.*\(.\).*>\(\2\4\w*\)/{s//\5\x09\1/
s/\>/-/4}
s/<.*>/\x09/
:1
s/-/<123456789-01>/
s/\(.\)<.*\1\(-*.\).*>/\2/
t1
h
s/0\B\|\s/ /gp
g
/\>\n/b
s/\(.*\)\x09/\1 /
T
s/\x09/\n/g
t
d}
N
b

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page