bubble sort by mazun

a[99],c,d,e,f,b,s,t;main(g){scanf("%d",&b);for(;c<b;scanf("%d",a+c++));for(c=0;c<b;c++)for(d=0;d<b-c-1;d++,puts(""))for(e=0,a[d]>a[d+1]&&(s++,t=a[d+1],a[d+1]=a[d],a[d]=t),printf("compare =%3d   swap =%3d   data:",g++,s);e<b;)printf("%3d",a[e++]);}

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

download

return to the top page