The weighted ancestor problem is a well-known generalization of the predecessor problem to trees. It is known to require $\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 (Proc. ESA 2014). 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, limiting its wider usage as an algorithmic tool. 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.
翻译:加权祖先问题是众所周知的对树的先前问题的概括问题。 众所周知, 需要$O( log\ log\ n) 时间才能查询 $O( mathop_ mathrm{polylog} n) $( $), 重量来自$( $. n) $( $) $( $) 是树节数。 但是, 在应用futix 树时, 问题令人惊讶地承认, 如Gawrychowski、 Lewenstein 和 Nicholson( ESA( Proc. 2014) 所显示的, 需要$( $) $( mathop_ p. n) log n) 的时间来查询 。 这个问题的变式可以重新表述如下: 鉴于字符串的后缀树是$( $. n. n), 重量来自$( $( $. n) $( $) $( p. q) ) 。 然而, 问题在应用 $( $( $( ) ) $(n) $(n) lax ( lex) op requiduduc) lex) lex) roduction) ad roduction) roduction ( roduction) roduction ( questal comm) comm) comm) commulation ( commus) laus) sublegal) cutional) sublegal) sublegal) sublegal