递归排序问题,看不太懂,哪位大侠能给解释解释?
字符置换排序,看不太懂,对递归算法认识还是有些肤浅,哪位大侠能给解释一下,顺便介绍几本专门学习递归算法的书(简单点的),谢谢了!void perm( char *list, int i, int n )
{
int j, temp;
if( i == n ){
for( j = 0; j <= n; j++ )
printf( "%c", list[ j ] );
printf( " " );
}
else {
for( j = i; j <= n; j++ ){
SWAP( list[ i ], list[ j ], temp );
perm( list, i+1, n );
SWAP( list[ i ], list[ j ], temp );
}
}
}