下列算法为奇偶交换排序,思路如下:第一趟对所有奇数的i,将a[i]和a[i+1]进行比较,第二趟对所有偶数的i,将a[i]和a[i+1]进行比较,每次比较a[i]>a[i+1],将二者交换;以后重复上述二趟过程,直至整个数组有序。void oesort (int a[n]){int flag,i,t;do {flag=0;for(i=1;i
a[i+1]) {flag=(1)__; t=a[i+1]; a[i+1]=a[i]; (2)____;}for (3)____ if (a[i]>a[i+1]) {flag=(4)____;t=a[i+1]; a[i+1]=a[i]; a[i]=t;} }while (5)_;}