bubble sort by kozima

(setf n(read)a(loop collect(read)repeat n)c 0 s 0)(#0=dotimes(i n)(#0#(j(- n i 1))(or(< #1=(nth j a)#2=(nth(1+ j)a))(rotatef #1##2#)(incf s))(format t"compare =~3D   swap =~3D   data:~{~3D~}
"(incf c)s a)))

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

download

return to the top page