English

Size-constrained Weighted Ancestors with Applications

Data Structures and Algorithms 2024-05-24 v2

Abstract

The weighted ancestor problem on a rooted node-weighted tree TT is a generalization of the classic predecessor problem: construct a data structure for a set of integers that supports fast predecessor queries. Both problems are known to require Ω(loglogn)\Omega(\log\log n) time for queries provided O(n polylogn)\mathcal{O}(n\text{ poly} \log n) space is available, where nn is the input size. The weighted ancestor problem has attracted a lot of attention by the combinatorial pattern matching community due to its direct application to suffix trees. In this formulation of the problem, the nodes are weighted by string depth. This research has culminated in a data structure for weighted ancestors in suffix trees with O(1)\mathcal{O}(1) query time and an O(n)\mathcal{O}(n)-time construction algorithm [Belazzougui et al., CPM 2021]. In this paper, we consider a different version of the weighted ancestor problem, where the nodes are weighted by any function weight\textsf{weight} that maps the nodes of TT to positive integers, such that weight(u)size(u)\textsf{weight}(u)\le \textsf{size}(u) for any node uu and weight(u1)weight(u2)\textsf{weight}(u_1)\le \textsf{weight}(u_2) if node u1u_1 is a descendant of node u2u_2, where size(u)\textsf{size}(u) is the number of nodes in the subtree rooted at uu. In the size-constrained weighted ancestor (SWA) problem, for any node uu of TT and any integer kk, we are asked to return the lowest ancestor ww of uu with weight at least kk. We show that for any rooted tree with nn nodes, we can locate node ww in O(1)\mathcal{O}(1) time after O(n)\mathcal{O}(n)-time preprocessing. In particular, this implies a data structure for the SWA problem in suffix trees with O(1)\mathcal{O}(1) query time and O(n)\mathcal{O}(n)-time preprocessing, when the nodes are weighted by weight\textsf{weight}. We also show several string-processing applications of this result.

Keywords

Cite

@article{arxiv.2311.15777,
  title  = {Size-constrained Weighted Ancestors with Applications},
  author = {Philip Bille and Yakov Nekrich and Solon P. Pissis},
  journal= {arXiv preprint arXiv:2311.15777},
  year   = {2024}
}

Comments

SWAT 2024

R2 v1 2026-06-28T13:32:36.593Z