填空題

在下面冒泡排序算法中填入適當(dāng)內(nèi)容,以使該算法在發(fā)現(xiàn)有序時能及時停止。
bubble(R)
Rectype R[n];
{int i,j,exchang;
Rectype temp;
i=1;
do
{exchang=False;
for(j=n;j>=¬¬i+1 ;j- -)
if(R[j] {temp=R[j-1];
R[j-1]=R[j];
R[j]=temp;
exchang=True ;
}
() ;
}while(exchang=False );
}


您可能感興趣的試卷

你可能感興趣的試題