void cmpCountSort( int a[ ], int b[ ], int n )
{ int i, j, *count;
count = ( int * ) malloc( sizeof(int)*n ); // C++语言:count = new int[n];
for ( i = 0; i < n; i++ ) count[i] = 0;
for ( i = 0; i < n-1; i++ )
for ( j = i+1; j < n; j++ )
if ( a[i] < a[j] ) count[j] ++;
else count[i] ++;
for ( i = 0; i < n; i++ ) b[ count[i] ] = a[i];
free( count ); // C++语言:delete count;
}
(1)若有int a[ ]={25, -10, 25, 10, 11, 19}, b[6];,则调用cmpCountSort(a, b, 6)后数组b中的内容是什么?
(2)该算法是稳定的吗?若是,则阐述理由,否则,修改为稳定排序算法。