知识卡片
相同片段在重排后共享秩
MAKE-RANKS遍历已按左右秩排序的片段:相邻二元组相同就赋同一个新秩,不同才递增。新秩表示当前长度片段的字典序等级,可在下一轮用两个整数比较更长片段。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第32章 字符串匹配 · 查看原书依据
MAKE-RANKS takes a substr-rank array, which has been sorted, and fills in an array rank[1:n] so that rank[i] is the rank of the ith substring represented in the substr-rank array. Each rank is a positive integer, starting from 1, and going up to the number of unique substrings of length 2l. Substrings with equal values of left-rank and right-rank receive the same rank. Otherwise, a substring that is lexicographically smaller than another appears earlier in the substr-rank array, and it receives a
参考来源
- 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[70000,75000))。
- 结论依据:原文第32.5节后缀数组、LCP和倍增构造的定义、示例或正确性推导。
- 原始内容:M AKE -R ANKS takes a substr-rank array, which has been sorted, and fills in an array rank [1: n ] so that rank [ i ] is the rank of the i th substring represented in the substr-rank array. Each rank is a positive integer, starting from 1, and going up to the number of unique substrings of length 2 l . Substrings with equal values of left-rank and right-rank receive the same rank. Otherwise, a substring that is lexicographically smaller than another appears earlier in the substr-rank array, and it receives a