摘要: //program 3-3 #include using namespace std; int Partition(int r[],int low,int high)//划分函数 { int i=low,j=high,pivot=r[low];//基准元素 while(ipivot) j--;//向左扫描 if(ipivot) j--;//向左扫描 ... 阅读全文
posted @ 2019-08-07 16:08 xjyxp01 阅读(410) 评论(0) 推荐(0) 编辑
摘要: //program 3-2 #include #include using namespace std; void Merge(int A[], int low, int mid, int high) { int *B=new int[high-low+1];//申请一个辅助数组 int i=low, j=mid+1, k=0; while(i>n; cout... 阅读全文
posted @ 2019-08-07 14:27 xjyxp01 阅读(160) 评论(0) 推荐(0) 编辑
摘要: //program 5-4 #include #include //求绝对值函数需要引入该头文件 #define M 105 using namespace std; int n;//n表示n个皇后 int x[M]; //x[i]表示第i个皇后放置在第i行第x[i]列 long long countn; //countn表示n皇后问题可行解的个数 bool Place(int... 阅读全文
posted @ 2019-08-07 12:15 xjyxp01 阅读(125) 评论(0) 推荐(0) 编辑