The suffix array and the suffix tree are the two most fundamental data structures for string processing. For a length-$n$ text, however, they use $\Theta(n \log n)$ bits of space, which is often too costly. To address this, Grossi and Vitter [STOC 2000] and, independently, Ferragina and Manzini [FOCS 2000] introduced space-efficient versions of the suffix array, known as the compressed suffix array (CSA) and the FM-index. Sadakane [SODA 2002] then showed how to augment them to obtain the compressed suffix tree (CST). For a length-$n$ text over an alphabet of size $\sigma$, these structures use only $O(n\log\sigma)$ bits. The biggest remaining open question is how efficiently they can be constructed. After two decades, the fastest algorithms still run in $O(n)$ time [Hon et al., FOCS 2003], which is $\Theta(\log_{\sigma} n)$ factor away from the lower bound of $\Omega(n/\log_{\sigma}n)$. In this paper, we make the first in 20 years improvement in $n$ for this problem by proposing a new compressed suffix array and a new compressed suffix tree which admit $o(n)$-time construction algorithms while matching the space bounds and the query times of the original CSA/CST and the FM-index. More precisely, our structures take $O(n\log\sigma)$ bits, support SA queries and full suffix tree functionality in $O(\log^{\epsilon}n)$ time per operation, and can be constructed in $O(n \min(1,\log\sigma/\sqrt{\log n}))$ time using $O(n\log\sigma)$ bits of working space. We derive this result as a corollary from a much more general reduction: We prove that all parameters of a compressed suffix array/tree (query time, space, construction time, and construction working space) can essentially be reduced to those of a data structure answering new query types that we call prefix rank and prefix selection. Using the novel techniques, we also develop a new index for pattern matching.
翻译:后缀数组和后缀树是字符串处理中最基础的两大数据结构。然而,对于长度为$n$的文本,它们需要占用$\Theta(n \log n)$比特的空间,这往往过于昂贵。为解决这一问题,Grossi和Vitter [STOC 2000] 以及Ferragina和Manzini [FOCS 2000] 独立提出了后缀数组的空间高效版本,即压缩后缀数组(CSA)和FM索引。随后,Sadakane [SODA 2002] 展示了如何对它们进行扩展,从而得到压缩后缀树(CST)。对于长度为$n$、字母表大小为$\sigma$的文本,这些结构仅需占用$O(n\log\sigma)$比特的空间。剩余最大的开放问题是它们能被构造得多么高效。经过二十年的发展,最快的算法仍需要$O(n)$时间 [Hon等, FOCS 2003],这比下界$\Omega(n/\log_{\sigma}n)$多了一个$\Theta(\log_{\sigma} n)$因子。在本文中,我们在该问题的时间复杂度$n$上取得了20年来的首次改进,提出了一种新的压缩后缀数组和一种新的压缩后缀树,它们支持$o(n)$时间的构造算法,同时匹配原始CSA/CST和FM索引的空间界与查询时间。更精确地说,我们的结构占用$O(n\log\sigma)$比特空间,支持每次操作$O(\log^{\epsilon}n)$时间的后缀数组查询和完整后缀树功能,并且可以在$O(n \min(1,\log\sigma/\sqrt{\log n}))$时间内、使用$O(n\log\sigma)$比特工作空间构造完成。我们通过一个更为通用的归约得到这一结果:我们证明,压缩后缀数组/树的所有参数(查询时间、空间、构造时间和构造工作空间)本质上都可归约到一种回答我们称为前缀查询和前缀选择的新型查询的数据结构。利用这些新技术,我们还开发了一种用于模式匹配的新索引。