![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
String算法
lambda_tea
这个作者很懒,什么都没留下…
展开
-
02_using_automaton
....翻译 2011-12-21 21:29:55 · 166 阅读 · 0 评论 -
01_brute_force
/* 时间复杂度:O(m*n) */#define EOS '\0'int brute_force(char* x,int m,char* y,int n){ char* yb; for(yb = y; *y!=EOS; ++y) { if(memcmp(x,y,m) == 0) { return (y -翻译 2011-12-21 21:21:16 · 194 阅读 · 0 评论 -
03_Karp_Rabin
使用hash函数预处理的时间复杂度是 O(m) //对比较字符串进行hash查找时间复杂度是O(m*n)Code:#define REHASH(a,b,h) ((((h)-(a)*d)<<1)+(b))int KR(char* x,int m,char* y,int n){ /* preprocessing */ for(d=i=1;i<m;++i)翻译 2011-12-21 22:40:57 · 200 阅读 · 0 评论 -
04_Shift_Or
使用bitwise技术查找阶段时间复杂度为O(n)Code:翻译 2011-12-21 22:48:40 · 172 阅读 · 0 评论