摘要: 采用树存储父亲和母亲信息,共有两个数组,一个用来存储父亲节点信息,一个用来存储母亲 查找函数:向上查找,出了五服或未出五服但可供查找的信息已经完结都要返回yes 五服之内有相同的祖先返回No 某些人的父母可能会离婚然后又结婚,需要记录父母的性别 阅读全文
posted @ 2017-10-03 15:33 diamondDemand 阅读(629) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; /*********************** * writer: HangFeiYu * * date: 2017/9/28 * **********************/ void knapSack(int width, int n, int w[], int v[]) //w i... 阅读全文
posted @ 2017-09-28 20:36 diamondDemand 阅读(437) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <cstdio> using namespace std; void traceBack(int i, int j, int **s){ if(i==j) //the function is used to record the optimal 阅读全文
posted @ 2017-09-27 20:53 diamondDemand 阅读(423) 评论(0) 推荐(0) 编辑
摘要: // 用分治法求众数 //参考:http://blog.csdn.net/core__code/article/details/47385045 #include #include using namespace std; void split(int s[], int n, int &l, int &r) //here should have a low limit, becau... 阅读全文
posted @ 2017-09-26 11:20 diamondDemand 阅读(433) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 void mergeLocal(int arr[], int low, int middle, int high) 7 { 8 int i, j, k; //i and j respectively represent the current ... 阅读全文
posted @ 2017-09-25 16:25 diamondDemand 阅读(284) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; void QSort(int a[], int low, int high) { if(low>=high) //关于这个终止条件, 在下边处理后,low可能会大于或等于high { return; } int first = low; int last = high; int key = a... 阅读全文
posted @ 2017-09-24 20:08 diamondDemand 阅读(143) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; void QSort(int a[], int low, int high) { if(low>=high) //关于这个终止条件, 在下边处理后,low可能会大于或等于high { return; } int first = low; int last = high; ... 阅读全文
posted @ 2017-09-24 17:02 diamondDemand 阅读(194) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; void prim(int n, int u0, double **c) { bool s[n]; int closest[n]; double lowcost[n]; for(int i=0; ic[t][j]) { ... 阅读全文
posted @ 2017-09-23 11:55 diamondDemand 阅读(623) 评论(0) 推荐(0) 编辑
摘要: the source of the article:https://github.com/Fibird/Round-robin-schedule #include <iostream>#include <math.h> #define N 3 using namespace std; int mai 阅读全文
posted @ 2017-09-22 21:14 diamondDemand 阅读(404) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>#include <list> //we use the list container , because it is easy to sort and get the biggest number and smallest n 阅读全文
posted @ 2017-09-22 17:37 diamondDemand 阅读(239) 评论(0) 推荐(0) 编辑