KMPmatch 字符串模式匹配
摘要:
O(m+n)计算后缀数组时,子串进行的也是模式匹配。/* KMP match */# include <stdio.h># include <string.h># include <stdlib.h>/* P in T */int KMPmatch(char *T, char *P){ int n, m; int i, j, k, *next; n = strlen(T); m = strlen(P); next = (int *)malloc((m-1)*sizeof(int)); /* compute postfix : next[] */ nex... 阅读全文
posted @ 2012-02-20 21:39 getgoing 阅读(319) 评论(0) 推荐(0) 编辑