![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
回溯
文章平均质量分 67
imck
做一个有思想的程序员
展开
-
幂集问题(组合问题)
求含N个元素的集合的幂集。 如对于集合A={1,2,3},则A的幂集为 p(A)={{1,2,3},{1,2},{1,3},{1},{2,3},{2},{3},Φ} 分析: 可以用回溯法来解决,定义以原创 2014-09-22 13:44:39 · 1922 阅读 · 0 评论 -
N皇后问题
直接上码: #include using namespace std; void NQueens(int **a, int row, int n) { if(row <= n) { for(int col = 0; col < n; col++) { bool flag = true; // <判断同列上无冲突 for(int i = 0; i <= row; i+原创 2014-09-22 14:44:42 · 368 阅读 · 0 评论