知识卡片
失配边由模式自身预处理得到
若新字符等于模式下一字符,自动机沿主干从q到q+1;
失配时它无需重扫文本,而转向当前文本末尾还能保留的最长模式前缀。
预处理时让模式与自身比较,提前建好这些回退转移。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第32章 字符串匹配 · 查看原书依据
There are two cases to consider, depending on whether the next character continues to match the pattern. In the first case, a = P[q + 1], so that the character a continues to match the pattern. In this case, because δ(q, a) = q + 1, the transition continues to go along the “spine” of the automaton (the blue edges in Figure 32.6(a)). In the second case, a ≠ P[q + 1], so that a does not extend the match being built. In this case, we need to find the longest prefix of
参考来源
- 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[25000,30000))。
- 结论依据:原文第32.2–32.3节对应算法、定义或复杂度说明;公式与示意图已核对。
- 原始内容:There are two cases to consider, depending on whether the next character continues to match the pattern. In the first case, a = P [ q + 1], so that the character a continues to match the pattern. In this case, because δ ( q , a ) = q + 1, the transition continues to go along the “spine” of the automaton (the blue edges in Figure 32.6(a) ). In the second case, a ≠ P [ q + 1], so that a does not extend the match being built. In this case, we need to find the longest prefix of