随笔分类 - 数据结构和算法
摘要:http://wenku.baidu.com/view/b49ebf42be1e650e52ea999a.html
阅读全文
摘要://输入待排数组,cur=0,end为数组长度void perm(int a[], int cur, int end){ int i = cur; if (cur == end) { for (int j = 0; j < end; j++) { cout << a[j] << " "; } cout << endl; } while(i < end) { swap(a[i],a[cur]);//把a[i]拿出来放在前面,排列剩下的 perm(a, cur + 1, end); swap(a[i], a[cur]);//排列好
阅读全文

浙公网安备 33010602011771号