知识卡片
重复因子度量字符串整段重复
若字符串x能写成某个字符串y连续拼接r次,就说x具有重复因子r;ρ(x)取可行r的最大值。
它衡量整个x的周期重复程度,不能把“某个局部子串重复”直接算进去。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第32章 字符串匹配 · 查看原书依据
We say that a string x ∈ ∑* has repetition factor r if x = yr for some string y ∈ ∑* and some r > 0. Let ρ(x) denote the largest r such that x has repetition factor r. a. Give an efficient algorithm that takes as input a pattern P[1:m] and computes the value ρ(P[:i]) for i = 1, 2,
参考来源
- 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[85000,90000))。
- 结论依据:原文第32.5节复杂度、LCP算法与引理,或章末问题32-1/32-2给出的定义与构造步骤。
- 原始内容:We say that a string x ∈ ∑* has repetition factor r if x = y r for some string y ∈ ∑* and some r > 0. Let ρ ( x ) denote the largest r such that x has repetition factor r . a. Give an efficient algorithm that takes as input a pattern P [1: m ] and computes the value ρ ( P [: i ]) for i = 1, 2, …, m . What is the running time of your algorithm? b. For any pattern P [1: m ], let ρ *( P ) be defined as max { ρ ( P [: i ]) : 1 ≤