bubble sort by kozima

(setf n(read)a(loop repeat n collect(read))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 = ~2D   swap = ~2D   data: ~{~2D~^ ~}
"(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