设为首页 加入收藏

TOP

经典算法研究系列:六、教你从头到尾彻底理解KMP算法(二)
2014-11-23 21:53:33 来源: 作者: 【 】 浏览:15
Tags:经典 算法 研究 系列 从头到尾 彻底 理解 KMP
th];
int index;
overlay_function[0] = -1;
for(int i=1;i {
index = overlay_function[i-1];
//store previous fail position k to index;

while(index>=0 && pattern[i]!=pattern[index+1])
{
index = overlay_function[index];
}
if(pattern[i]==pattern[index+1])
{
overlay_function[i] = index + 1;
}
else
{
overlay_function[i] = -1;

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇经典算法研究系列:四、教你通透.. 下一篇经典算法研究系列:七、深入浅出..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: