知识卡片

普通读书笔记卡 · 3705.c.1

拉宾卡普仍有逐位移验真最坏界

理解等级:中级

拉宾卡普虽然用指纹快速排除大多数位移,但所有有效位移都需逐字符确认。

若文本与模式均为重复的同一字符,每个位置都命中且需比较m字符,最坏时间仍为Θ((n−m+1)m)。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第32章 字符串匹配 · 查看原书依据

      RABIN-KARP-MATCHER takes Θ(m) preprocessing time, and its matching time is Θ((n − m + 1)m) in the worst case, since (like the naive string-matching algorithm) the Rabin-Karp algorithm explicitly verifies every valid shift. If P = am and T = an, then verifying takes Θ((n−m+1)m) time, since each of the n−m+1 possible shifts is valid. In many applications, you expect few valid shifts—perhaps some

    参考来源

    - 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[15000,20000))。 - 结论依据:原文第32.2–32.3节对应算法、定义或复杂度说明;公式与示意图已核对。 - 原始内容:R ABIN -K ARP -M ATCHER takes Θ( m ) preprocessing time, and its matching time is Θ(( n − m + 1) m ) in the worst case, since (like the naive string-matching algorithm) the Rabin-Karp algorithm explicitly verifies every valid shift. If P = a m and T = a n , then verifying takes Θ(( n − m +1) m ) time, since each of the n − m +1 possible shifts is valid. In many applications, you expect few valid shifts—perhaps some