.下列算法为奇偶交换排序思路如下第一趟对所有奇数的i将a[i]和a[i+]进行比较第二趟对所有偶数的i将a[i]和a[i+]进行比较每次比较时若a[i]>a[i+]将二者交换;以后重复上述二趟过程直至整个数组有序
程序(a)
PROCEDURE oesort(VAR a:ARRAY[n] OF integer);
VAR flag:boolean; it:integer;
BEGIN
REPEAT
flag:=false;
FOR i:= TO n step DO
IF(a[i]>a[i+]) THEN
[flag:= ____()____; t:=a[i+]; a[i+]:=a[i]; ____()____]
FOR i:= ____()____ DO
IF (a[i]>a[i+]) THEN
[flag:= ____()____ ; t:=a[i+];a[i+]:=a[i]; a[i]:=t;]
UNTIL ____()____ ;
END;
程序(b)
void oesort (int a[n])
{int flagit;
do {flag=;
for(i=;i<n;i++i++)
if(a[i]>a[i+])
{flag=____()____; t=a[i+]; a[i+]=a[i]; ____()____;}
for ____()____
if (a[i]>a[i+])
{flag=____()____;t=a[i+]; a[i+]=a[i]; a[i]=t;}
}while ____()____;
}【上海大学 一 (分)】
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []