原书出处
Introduction to Algorithms, Fourth Edition
32 第32章 字符串匹配
.6 Let P be a pattern of length m, and let π be the prefix function for P. For q = 1, 2, …
, m, if π[q] > 0, then π[q] – 1 ∈ π*[q – 1]. Proof Let r = π[q] > 0, so that r < q and P[:r] ⊐ P[:q], and thus, r – 1 < q – 1 and P[:r – 1] ⊐ P[:q – 1] (by dropping the last character from P[:r] and P[:q], which we can do because r > 0). By Lemma 32.5, therefore, r – 1 ∈ π*[q –
1]. Thus, we have π[q] – 1 = r – 1 ∈ π*[q – 1]. ▪ For q = 2, 3, …, m, define the subset E
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Introduction to Algorithms, Fourth Edition/_epub-src/OEBPS/chapter032.xhtml
EPUB SHA-256:ec7ced04bb875b93983816aef7a667855a4b71c5cf53b63406b9439c74e27aea