知识卡片
模数让窗口指纹保持机器字宽
长模式的整数表示可能过大,拉宾卡普改为对模式与每个窗口的数值取模q,并用模运算滚动更新。
适当选q可使d·q装入机器字;模指纹相等只是候选,真实字符核验与误命中留待下一单元。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第32章 字符串匹配 · 查看原书依据
Then the values of p and ts might be too large to work with in constant time. Fortunately, this problem can be solved, as Figure 32.4 shows: compute p and the ts values modulo a suitable modulus q. You can compute p modulo q in Θ(m) time and all the ts values modulo q in Θ(n − m + 1) time. With |∑| = 10, if you choose the modulus q as a prime such that 10q just fits within one computer word, then you can perform all the necessary computations with single-precision
参考来源
- 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[10000,15000))。
- 结论依据:原文定义字符串匹配、前后缀或相应算法的比较规则;相关图式已核对。
- 原始内容:Then the values of p and t s might be too large to work with in constant time. Fortunately, this problem can be solved, as Figure 32.4 shows: compute p and the t s values modulo a suitable modulus q . You can compute p modulo q in Θ( m ) time and all the t s values modulo q in Θ( n − m + 1) time. With |∑| = 10, if you choose the modulus q as a prime such that 10 q just fits within one computer word, then you can perform all the necessary computations with single-precision