随笔分类 -  数据结构和算法

摘要:http://wenku.baidu.com/view/b49ebf42be1e650e52ea999a.html 阅读全文
posted @ 2012-05-10 16:27 lidan 阅读(210) 评论(0) 推荐(0)
摘要://输入待排数组,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]);//排列好 阅读全文
posted @ 2011-09-20 10:42 lidan 阅读(177) 评论(0) 推荐(0)