
算法
杨葳
这个作者很懒,什么都没留下…
展开
-
KMP算法
http://jakeboxer.com/blog/2009/12/13/the-knuth-morris-pratt-algorithm-in-my-own-words/1.partial_match_table的建立 2.查找#include <iostream> #include <string> #include <vector> #include <assert.h>using name转载 2017-03-25 14:44:15 · 244 阅读 · 0 评论 -
Trie
struct Node { map<char, Node*> children; bool is_end_of_word; Node() : is_end_of_word(false) {} Node(char key, Node* next) : is_end_of_word(false) { children.insert(map<char, Node*>::va原创 2017-03-27 14:07:10 · 268 阅读 · 1 评论 -
堆排序
堆排序过程 1. 建立堆 2. 对堆排序 统计大文件中数据单词次数前k的问题中需要应用。 注意 : 1. 堆的建立过程是从底自上; 2. 堆的排序过程是从上自下,其过程很好理解,在建立堆的过程中要从底部向上调整元素,保证底部子节点小于父节点,如果先从父节点开始,则不能保证此性质;排序过程则需要将最大元素(最小元素)排除出去,所以是堆顶开始,从上自下调翻译 2017-05-31 13:08:03 · 182 阅读 · 0 评论