{a[n++]=$0}END{for(;--n;)for(i=0;j=++i<n;){s+=v=(c=a[i])>a[i]=a[i+1] for(a[i+v]=c;v=a[j];j++)$j=v>9?v:FS v printf"compare =%3d swap =%3d data: "$0RS,++k,s}}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page