← 返回起始笔记位置

知识卡片

普通读书笔记卡 · 3705.b

模数让窗口指纹保持机器字宽

理解等级:中级

长模式的整数表示可能过大,拉宾卡普改为对模式与每个窗口的数值取模q,并用模运算滚动更新。

适当选q可使d·q装入机器字;模指纹相等只是候选,真实字符核验与误命中留待下一单元。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 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