arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.09023cs.DS
收藏

稀疏后缀数组与LCP数组:简单、直接、紧凑且快速

Sparse Suffix and LCP Array: Simple, Direct, Small, and Fast

Lorraine A. K. Ayad, Grigorios Loukides, Solon P. Pissis, Hilde Verbeek

AI总结:

本文提出两种构造稀疏后缀数组与LCP数组的新算法,兼具简单、直接、紧凑和快速特性,最坏时间O(n log b),空间仅8b+o(b)机器字,并通过实验验证其简单性与高效性。

摘要:

稀疏后缀排序是指对长度为n的字符串中b=o(n)个后缀进行排序的问题。高效的稀疏后缀排序算法已经存在了十多年。尽管已有大量工作及其在文本索引应用中的合理声明,现有算法尚未被实践者采用。可以说这是因为没有简单、直接且高效的稀疏后缀数组构造算法。我们提供了两种用于构造稀疏后缀数组和LCP数组的新算法,它们同时具备简单、直接、紧凑和快速的特点。具体而言,我们的算法:简单,体现在它们可以仅使用基本数据结构实现;直接,体现在输出数组不是构造稀疏后缀树或LCE数据结构的副产品;快速,体现在它们在最坏情况下以O(n log b)时间运行,或者当LCP值大于2^{⌊log(n/b)⌋+1}-1的后缀总数在O(b/log b)内时以O(n)时间运行,与最优但复杂得多的算法[Gawrychowski and Kociumaka, SODA 2017; Birenzwige et al., SODA 2020]的时间相匹配;紧凑,体现在它们可以仅使用8b+o(b)个机器字实现。我们的算法是对I等人提出的用于在O(n log b)时间内构造稀疏后缀树的Monte Carlo算法[STACS 2014]的非平凡空间高效改造。我们提供了大量实验来证明我们在简单性和效率方面的主张。

英文摘要:

Sparse suffix sorting is the problem of sorting $b=o(n)$ suffixes of a string of length $n$. Efficient sparse suffix sorting algorithms have existed for more than a decade. Despite the multitude of works and their justified claims for applications in text indexing, the existing algorithms have not been employed by practitioners. Arguably this is because there are no simple, direct, and efficient algorithms for sparse suffix array construction. We provide two new algorithms for constructing the sparse suffix and LCP arrays that are simultaneously simple, direct, small, and fast. In particular, our algorithms are: simple in the sense that they can be implemented using only basic data structures; direct in the sense that the output arrays are not a byproduct of constructing the sparse suffix tree or an LCE data structure; fast in the sense that they run in $\mathcal{O}(n\log b)$ time, in the worst case, or in $\mathcal{O}(n)$ time, when the total number of suffixes with an LCP value greater than $2^{\lfloor \log \frac{n}{b} \rfloor + 1}-1$ is in $\mathcal{O}(b/\log b)$, matching the time of the optimal yet much more complicated algorithms [Gawrychowski and Kociumaka, SODA 2017; Birenzwige et al., SODA 2020]; and small in the sense that they can be implemented using only $8b+o(b)$ machine words. Our algorithms are non-trivial space-efficient adaptations of the Monte Carlo algorithm by I et al. for constructing the sparse suffix tree in $\mathcal{O}(n\log b)$ time [STACS 2014]. We provide extensive experiments to justify our claims on simplicity and on efficiency.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑