Kmp字符串模式匹配算法.pdfVIP

  • 1
  • 0
  • 约9.68千字
  • 约 8页
  • 2023-02-14 发布于中国
  • 举报
. . . . . Kmp 中查找一个字符串中是否包含另外一个字符串 #includestdio.h 2 #includestring.h 3 void makeNext(const char P[],int next[]) 4 { 5 int q,k; 6 int m = strlen(P); 7 next[0] = 0; 8 for (q = 1,k = 0; q m; ++q) 9 { 10 while(k 0 P[q] != P[k]) 11 k = next[k-1]; 12 if (P[q] == P[k]) 13 { 14 k++; 15 } 16 next[q] = k; 17 } 18 } 19 20 int kmp(const char T[],const char P[],in

文档评论(0)

1亿VIP精品文档

相关文档