向前进就会获得信念
//compare the consecutive numbers, larger one sinks to the bottom void bubbleSort(int *a) { // int temp; for(int j = 0; j < arraysize; j++) { for( int i = 0; i < arraysize - j - 1;i++ ) { if( a[i] > a[i+1] ) {swap(a[i], a[i+1]);} } } }
{
for( int i = 0; i < arraysize - j - 1;i++ )
if( a[i] > a[i+1] ) {swap(a[i], a[i+1]);} } } }
Post a Comment
No comments:
Post a Comment