KMP算法模板+POJ3461实现

void preKmp(char *src, int m, int *rule){ int i=0,j=-1; rule[0]=j; while(i=m) rule[i]=rule[j-1]; else rule[i]=j; } } void kmp(char *src, int m, char *dest, int n) { int rule[10005]; preKmp(src,m,rule); int i=0, j=0; while(i

 

POJ3461完整代码

#include #include void preKmp(char *src, int m, int *rule){ int i=0,j=-1; rule[0]=j; while(i=m) rule[i]=rule[j-1]; else rule[i]=j; } } int recount=0; void kmp(char *src, int m, char *dest, int n) { int rule[10005]; preKmp(src,m,rule); int i=0, j=0; while(i

你可能感兴趣的:(算法,im)