bubble sort by ySas

map{$-++,@@[$a,$_]=@@[$_,$a]if$@[$a=$_-1]>$@[$_];printf"compare =%3d   swap =%3d   data:"."%3d"x@@.$/,++$c,$-,@@}1..--$@for($@,@@)=<>

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

download

return to the top page