知识卡片

普通读书笔记卡 · 3706.b.1.a

转移函数按追加字符后的后缀求值

理解等级:中级

处于状态q并读到字符a时,转移到δ(q,a)=σ(P[:q]a):先把当前已匹配的模式前缀后接a,再找仍是模式前缀的最长后缀。这能在继续匹配与失配回退之间选出正确状态。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第32章 字符串匹配 · 查看原书依据

      Thus, when the automaton is in state q, the transition function δ on character a should take the automaton to state δ(q, a) = δ(ϕ(T[:i]), a) = ϕ(T[:i]a) = σ(P[:q]a) (with the last equality following from equation (32.5)). 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

    参考来源

    - 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[25000,30000))。 - 结论依据:原文第32.2–32.3节对应算法、定义或复杂度说明;公式与示意图已核对。 - 原始内容:Thus, when the automaton is in state q , the transition function δ on character a should take the automaton to state δ ( q , a ) = δ ( ϕ ( T [: i ]), a ) = ϕ ( T [: i ] a ) = σ ( P [: q ] a ) (with the last equality following from equation (32.5)). 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