The weighted ancestor problem is a well-known generalization of the predecessor problem to trees. It is known that it requires $\Omega(\log\log n)$ time for queries provided $O(n\mathop{\mathrm{polylog}} n)$ space is available and weights are from $[0..n]$, where $n$ is the number of tree nodes. However, when applied to suffix trees, the problem, surprisingly, admits an $O(n)$-space solution with constant query time as was shown by Gawrychowski, Lewenstein, and Nicholson. This variant of the problem can be reformulated as follows: given the suffix tree of a string $s$, we need a data structure that can locate in the tree any substring $s[p..q]$ of $s$ in $O(1)$ time (as if one descended from the root reading $s[p..q]$ along the way). Unfortunately, the data structure of Gawrychowski et al. has no efficient construction algorithm, which apparently prevents its wide usage. In this paper we resolve this issue describing a data structure for weighted ancestors in suffix trees with constant query time and a linear construction algorithm. Our solution is based on a novel approach using so-called irreducible LCP values.
翻译:加权祖先问题是众所周知的对树的先前问题的概括问题。 众所周知, 它需要$Omega( log\ log n n) 的时间来查询 $O( mathop_ mathrm{polylog} n) $( $) 空间, 重量来自$[.n] $( $), 其中美元是树节数。 但是, 当应用到麻布树时, 问题令人惊讶地承认了一个美元( n) 美元- 空间解决方案, 并有如 Gawrychowski、 Lewenstein 和 Nicholson 所显示的不断查询时间 。 这个问题的变式可以重新表述如下: 鉴于字符串的后缀树 $( $. n), 我们需要一个可以定位为$[ p. 美元 的树节数 的数据结构。 但是, 问题却令人惊讶的是, Gawrychowski et al 和 Nicholson 所显示的数据结构没有效率的构建算法, 我们用一个基于不断的直线式的模型解算方法, 解决了我们这个结构, 。 一个基于不断的系统算算算的模型的模型, 问题。 我们用一个不重的计算方法解决了这个结构, 。