摘要: 常见的字符串匹配算法中,KMP算法是比较难懂的一个,其中的思想和实现的方法也有很多种,下面介绍一种适用比较广的情况: 1 #include 2 #include 3 using namespace std; 4 5 int KMP_Match(const string &target, const string &pattern) { 6 //计算匹配串的“部分匹配表”jump[] 7 const int pLength = pattern.length(); 8 vector jump(pLength); 9 10 jump[0] = -1;... 阅读全文
posted @ 2013-10-11 11:50 Little_T 阅读(237) 评论(0) 推荐(0)