知识卡片

普通读书笔记卡 · 3704.c.2

跨位移复用失配信息可少比较

理解等级:中级

朴素算法在每个新位移重新比较,忽略了先前已知的文本字符。

若模式已有匹配部分或某位已失配,这些信息可能排除后续若干位移;KMP等方法正是利用这种约束减少重复工作。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

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

      The naive string-matcher is inefficient because it entirely ignores information gained about the text for one value of s when it considers other values of s. Such information can be quite valuable, however. For example, if P = aaab and s = 0 is valid, then none of the shifts 1, 2, or 3 are valid, since T[4] = b. The following sections examine several ways to make effective use of this sort of

    参考来源

    - 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[5000,10000))。 - 结论依据:原文定义字符串匹配、前后缀或相应算法的比较规则;相关图式已核对。 - 原始内容:The naive string-matcher is inefficient because it entirely ignores information gained about the text for one value of s when it considers other values of s . Such information can be quite valuable, however. For example, if P = aaab and s = 0 is valid, then none of the shifts 1, 2, or 3 are valid, since T [4] = b . The following sections examine several ways to make effective use of this sort of