知识卡片
后缀函数量出模式最长前缀
针对固定模式P,后缀函数σ(x)是P的前缀中同时为x后缀的最长长度,取值0到m。
空串保证它总有定义;σ(x)=m当且仅当x以完整模式结尾。
这个长度可直接作为匹配自动机的状态。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第32章 字符串匹配 · 查看原书依据
, m} such that σ(x) is the length of the longest prefix of P that is also a suffix of x: Figure 32.6 (a) A state-transition diagram for the string-matching automaton that accepts all strings ending in the string ababaca. State 0 is the start state, and state 7 (in orange) is the only accepting state. The transition function δ is defined by equation (32.4), and a directed edge from state i to state j labeled a represents δ(i, a) = j. The right-going
参考来源
- 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[20000,25000))。
- 结论依据:原文第32.2–32.3节对应算法、定义或复杂度说明;公式与示意图已核对。
- 原始内容:The function σ maps ∑* to {0, 1, …, m } such that σ ( x ) is the length of the longest prefix of P that is also a suffix of x : Figure 32.6 (a) A state-transition diagram for the string-matching automaton that accepts all strings ending in the string ababaca . State 0 is the start state, and state 7 (in orange) is the only accepting state. The transition function δ is defined by equation (32.4), and a directed edge from state i to state j labeled a represents δ ( i , a ) = j . The right-going