原书出处
Introduction to Algorithms, Fourth Edition
32 第32章 字符串匹配
Therefore, FINITE-AUTOMATON-MATCHER operates correctly. Computing the transition function
The procedure COMPUTE-TRANSITION-FUNCTION on the following page computes the transition function δ from a given pattern P[1:m]. It computes δ(q, a) in a straightforward manner according to its definition in equation (32.4). The nested loops beginning on lines 1 and 2 consider all states q and all characters a, and lines 3–6 set δ(q, a) to be the largest k such that P[:k] ⊐ P[:q]a. The code starts with the largest conceivable value of k, which is q+1, unless q = m, in which
case k cannot be larger than m. It then decreases k until P[:k] is a suffix of P[:q]a, wh
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Introduction to Algorithms, Fourth Edition/_epub-src/OEBPS/chapter032.xhtml
EPUB SHA-256:ec7ced04bb875b93983816aef7a667855a4b71c5cf53b63406b9439c74e27aea