数据结构&算法
VitowithoutHair
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c++堆排序(STL+自实现)
#include <iostream> #include <algorithm> #include <vector> using std::endl; using std::cout; using std::vector; struct MaxHeapCmp { bool operator() (const int & lhs, const int ...原创 2020-03-31 00:58:44 · 923 阅读 · 0 评论 -
kmp好理解
相比于朴素的字符串匹配算法,KMP利用了每次比较后得知的信息来减少重复比较的次数。具体利用了什么信息?这就引出了所谓的next数组。next数组,用来存放模式字符串(pattern)中每个元素的能匹配到的最长前缀。为什么需要最长前缀,当然是为了避免漏掉可能的情况,举个例子:给定pattern字符串(aaabbb),根据最长前缀的定义,可得知next数组为[0,1,2,0,0,0],给定text字符...原创 2019-12-07 19:56:41 · 166 阅读 · 0 评论
分享