KMP
紫杉丶
这个作者很懒,什么都没留下…
展开
-
字符串匹配的KMP算法
字符串匹配是计算机的基本任务之一。 举例来说,有一个字符串"BBC ABCDAB ABCDABCDABDE",我想知道,里面是否包含另一个字符串"ABCDABD"? 许多算法可以完成这个任务,Knuth-Morris-Pratt算法(简称KMP)是最常用的之一。它以三个发明者命名,起头的那个K就是著名科学家Donald Knuth。 这种算法不太容易理解,网上有很多解释,原创 2015-03-29 22:25:51 · 280 阅读 · 0 评论 -
HDU 1686 Oulipo(KMP)
模板题。。新技能get #include #include int next[10005]; char str1[1000005],str2[10005]; int cnt; void get_next(int len2)//生成next数组 { int i = 0,j = -1; next[0] = -1; while (i<len2)原创 2015-03-30 22:25:38 · 307 阅读 · 0 评论 -
POJ 2406 Power Strings(循环节)
#include "string" #include "iostream" #include "cstdio" #include "cmath" #include "set" #include "queue" #include "vector" #include "cctype" #include "sstream" #include "cstdlib" #include "c原创 2015-04-06 21:56:36 · 269 阅读 · 0 评论