bubble sort by murky-satyr

n,*d=A.m &:toi
c=s=0
n.rh{|x|x.e{|i|s'compare =%3d   swap =%3d   data:'%[c+=1,s+=(p=d[i,2])<=>d[i,2]=p.so]+'%3s'*n%d}}

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

download

return top