KMP算法
KMP算法,全称Knuth-Morris-Pratt算法,根据三个作者Donald Knuth、Vaughan Pratt、James H. Morris的姓氏的首字母拼接而成的。是一种字符串匹配的算法,用于在一个文本串S中查找模式串P的位置。
public class KMP {
public static void main(String[] args) {
String x = "abcdefg", y = "cde";
int[] next = new int
原创
2020-07-06 10:54:45 ·
9365 阅读 ·
1 评论