填空题

在下面冒泡排序算法中填入适当内容,以使该算法在发现有序时能及时停止。
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 );
}

【参考答案】

i=i+1
热门 试题