下列算法为奇偶交换排序,思路如下:第一趟对所有奇数的i,将a[i]和a[i+1]进行比较,第二趟对所有偶数的i,将a[i]和a[i+1]进行比较,每次比较a[i]>a[i+1],将二者交换;以后重复上述二趟过程,直至整个数组有序。PROCEDURE oesort(VAR a:ARRAY[1..n] OF integer);VAR flag:boolean; i,t:integer;BEGINREPEATflag:=false;FOR i:=1 TO n step 2 DO IF(a[i]>a[i+1]) THEN[flag:= (1)____; t:=a[i+1]; a[i+1]:=a[i]; (2)____]FOR i:= (3)____ DO IF (a[i]>a[i+1]) THEN [flag:= (4)____ ; t:=a[i+1];a[i+1]:=a[i]; a[i]:=t;]UNTIL (5)___ ;END;