文章分类 - C++
摘要:void next_data(char mode[], int* next) { int i = 0; int k = 0; next[0] = 0; int str_len2 = strlen(mode); for (i = 1; i = 1)//k是从0开始,且匹配到的元素个数 { k = next[k - 1]; } if (mode[i] == mode[k]...
阅读全文
摘要:#include int partition(int a[], int l, int r){ int key = a[l], i = l, j = r; while (i= key) j--; if (i= r) return; //state 0 int mid = partition(a, l, r); qsort(a, l, mid - 1); //state 1...
阅读全文
摘要:typedef struct node { node* left; node* right; char x; }; struct record{ node* a; int state; record(node* a, int state) :a(a), state(state){} }; void CreateTree(node** root)//先序创建二叉树 { ch...
阅读全文
摘要:#include #include #include int cmp(int x, int y) { return x>y ? 1 : 0;//注意,这里返回的是0和1,不是x和y } int main(int argc, const char* argv[]) { //node* root; //CreateTree(&root); //printf("recursive_inor...
阅读全文
摘要:typedef struct Node { Node* lchild; Node* rchild; int data; } Node; int InsertTreeNode(int data, Node** root)//非递归式创建二叉排序树 { if (*root == NULL) { *root = (Node *)malloc(sizeof(Node)); (*ro...
阅读全文
摘要://归并排序 void Merge(int *cache, int *out, int st, int mid, int en) {//将两个有序的子序列,合并成最终的长序列 //此处省略n个字 } void SortMerge(int *data, int *out, int st, int en) { int out_cache[1000]; if (st == e...
阅读全文
摘要:递归适用的范畴: 既然的递归的思想是把问题分解成规模更小但和原问题有着相同解法的问题,那是不是所有具有这样特性的问题都能用递归来解决呢?答案是否定的。除了这个特性,能用递归解决的问题还必须具有一个特性:存在一种简单情境,能让递归在简单情境下退出,也就是要有一个递归出口。总结一下就是,能用递归解决的问
阅读全文
摘要:再说一个例子,判断一个序列是否是回文串(形如“level”, "abba"这样的字符串),这个问题也可以分解成解相同的子问题(去掉首尾的字符),仔细分析可以看出,同样也存在两种递归的简单情境,分别为当字符个数为奇数和偶数的情况下,当n=even时,简单情境为空字符串,空字符串也是回文串,当n=odd
阅读全文
摘要:https://www.cnblogs.com/linjj/p/5260763.html 堆的其他应用: 1.求一个数列中的第K大的数 建立一个大小为K的最小堆,堆顶就是第K大的数 例如,假设有10个数,要求求第3大的数,第一步选取任意的3个数,比如说是前3个,将这3个数建成最小堆,然后从第4个数开
阅读全文
摘要:// tmp.cpp : 定义控制台应用程序的入口点。 #include #include typedef struct Node { Node* lchild; Node* rchild; char bLchild; char bRchild; char data; Node() :lchild(NULL), rchild(NULL), bLchild(1), ...
阅读全文
摘要:#include #include #include #include using namespace std; typedef struct BigInteger { int BASE = 100000000; int width = 8; vector s; BigInteger(long long num = 0) { *this = num; } BigIn...
阅读全文
摘要:int a[10] = { 1, 4, 5, 3, 2, 1, 2, 3, 4, 2 }; sort(a, a + 10); //sort(a,a+10,cmp); int x; while (scanf("%d", &x) != EOF) { for (int i = 0; i //low=mid+1或者(mid偏大)high=mid...
阅读全文
摘要:https://www.jianshu.com/p/6392a94dd0fa
阅读全文
摘要:http://blog.csdn.net/gududeyhc/article/details/18655875 debug 对应 debug release 对应 release MD最好统一为MD, 如果工程是debug模式,则运行库必须为MDd,否则为MD MT最好统一为MT,如果工程师rele
阅读全文
摘要:MD即Earth Mover's Distance,是2000年IJCV期刊文章《The Earth Mover's Distance as a Metric for Image Retrieval》提出的一种直方图相似度量(作者在之前的会议论文中也已经提到,不过鉴于IJCV的权威性和完整性,建议参
阅读全文
摘要:http://www.cnblogs.com/chaosimple/p/3182157.html 一、统计学的基本概念 统计学里最基本的概念就是样本的均值、方差、标准差。首先,我们给定一个含有n个样本的集合,下面给出这些概念的公式描述: 均值: 标准差: 方差: 均值描述的是样本集合的中间点,它告诉
阅读全文
摘要:http://blog.csdn.net/jmy5945hh/article/details/20536929 讲解教授:赵辉 (FROM : UESTC) 课程:《模式识别》 整理:PO主 基础知识: 假设空间中两点x,y,定义: 欧几里得距离, Mahalanobis距离, 不难发现,如果去掉马
阅读全文
摘要:http://wenku.baidu.com/link?url=vHRBn2mcJh62JqF0205UN1RgTP_-3ElxnTU2oR5Udz2aasGHWOHtglqmG6lFB0UbFqrFCFvRz0DNhPiW2NEfS_q9FLrSCNGW1XQdzoGzOV7 http://www
阅读全文
摘要:http://blog.csdn.net/guojin08/article/details/42222637
阅读全文