← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 3707.d

逆后缀数组快速定位排序位置

理解等级:初级

逆数组rank满足rank[SA[i]]=i。

SA按字典序位置找文本起点,rank则按文本起点找其字典序位置;计算相邻后缀LCP时需要从文本顺序转到排序顺序。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

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

      , n. For a suffix T[i:], the value of rank[i] gives the position of this suffix in the lexicographically sorted order. Figure 32.11 includes the rank array for the ratatat example. For example, the suffix tat is T[5:]. To find this suffix’s position in the sorted order, look up rank[5] = 6. To compute the LCP array, we will need to

    参考来源

    - 位置:《算法导论(第4版)》第32章《字符串匹配》(OEBPS/chapter032.xhtml,文本字符[75000,80000))。 - 结论依据:原文第32.5节复杂度、LCP算法与引理,或章末问题32-1/32-2给出的定义与构造步骤。 - 原始内容:In order to compute the LCP array, we need an array rank that is the inverse of the SA array, just like the final rank array in C OMPUTE -S UFFIX -A RRAY : if SA [ i ] = j , then rank [ j ] = i . That is, we have rank [ SA [ i ]] = i for i = 1, 2, …, n . For a suffix T [ i :], the value of rank [ i ] gives the position of this suffix in the lexicographically sorted order. Figure 32.11 includes the rank array for the ratatat example. For example, the suffix tat is T [5:]. To find this suffix’s position in the sorted order, look up rank [5] = 6. To compute the LCP array, we will need to