随笔分类 -  KMP

摘要:kmp是从最初的字符串匹配算法优化而来的,其中就是多了一个函数值函数,记录最后的匹配的,从而得到优化,有回溯的感觉。只是对kmp的函数值函数求法有的不理解#include <iostream>#include <cstdio>#include <string.h>using namespace std;int n[1000];char str1[1000];char str2[1000];int sum;void kmp(char *p,int next[]){ int i; int j=0; int k=-1; next[0]=-1; while(p[j] 阅读全文
posted @ 2012-04-04 19:04 shijiwomen 阅读(285) 评论(0) 推荐(0)