冒泡排序中for(i= N-2)什么意思
//分數(shù)降序排序
void sort(int score[])
{
?? ?int i,j;
?? ?for(i=N-2;i>=0;i--)
?? ?{
?? ??? ?for(j=0;j<=i;j++)
?? ??? ?{
?? ??? ??? ?if(score[j]<score[j+1])
?? ??? ??? ?{
?? ??? ??? ??? ?int temp;
?? ??? ??? ??? ?temp = score[j];
?? ??? ??? ??? ?score[j] = score[j+1];
?? ??? ??? ??? ?score[j+1]=temp;???????????????? ?
?? ??? ??? ?}??????????????? ?
?? ??? ?}????????????????? ?
?? ?}
?? ?printScore(score);??? ?
}
?
2015-07-24
請自覺查閱冒泡排序法的構(gòu)思