摘要:
KMP算法用来求单模式串匹配。 简单来说,你需要给你的模式串计算一个 \(nxt\) 数组,使得 \(nxt[i]\) 是长度为 \(i\) 时的最长公共前后缀。 匹配到文本串的一个位置 \(i\) 时,相当于把文本串长度为 \(i\) 的前缀拿出来,找它的最长后缀(前缀的后缀即是子串)使得能与模式 阅读全文
posted @ 2020-06-17 06:43
With_penguin
阅读(40)
评论(0)
推荐(0)
摘要:
模板,代码如下: #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; const int N=1000009; char s1[N],s2[N]; int nxt 阅读全文
posted @ 2020-06-17 06:42
With_penguin
阅读(64)
评论(0)
推荐(0)

浙公网安备 33010602011771号