题目 题目分析 KMP算法首先是生成next数组然后就是匹配,已经写过很多次了,写几个需要注意的点1,next数组,初始化next[0]=-1,next[1]=0,我们从2开始遍历 三种情况的判断 if(match[cur-1]==match[pre]) { next[cur++]=++pre;//pre之前的字符算上当前的字符 //next[cur++]=(pre-0)+1; pre++; } else if(pre!=0) { pre=next[pre]; } else { next[cur++]=0; }2,正式匹配的时候,判断条件 if()//匹配的话,一直向前走 { }else...