选择排序 请问这里minIndex=passcount是什么作用呀
// Sorts data[length] into ascending order using selection sort
{ ItemType temp ;
int passCount ;
int sIndx ;
int minIndx ; // index of minimum so far
for ( passCount = 0 ; passCount < length - 1 ; passCount++ )
{
minIndx = passCount ;
// find index of smallest of data [ passCount . . length-1 ]
for ( sIndx = passCount + 1 ; sIndx < length ; sIndx++ )
if ( data [ sIndx ] < data [ minIndx ] )
minIndx = sIndx ;
temp = data [ minIndx ] ; // swap
data [ minIndx ] = data [ passCount ] ;
data [ passCount ] = temp ;
}
}
那样的话下标不就变化了吗