摘要: 这几天折腾了下KMP,终于算是理解了其中的原理。现在这里大概记录下,以备不时之需!! char str[MAXN]; //原串 char p[MAXN]; //需要在原串中寻找的字符串 相对于一般的字符串匹配,KMP算法优化的地方就在于 当发现当前匹配的位置 k + 1 匹配失... 阅读全文
posted @ 2015-04-02 12:57 poore 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 const int* get_substring_arr(const char* sequence); 5 void kmp(const char* src, const char* substring, const ... 阅读全文
posted @ 2015-04-02 12:26 poore 阅读(235) 评论(0) 推荐(0) 编辑