Optimal Near-Linear Space Heaviest Induced Ancestors

Authors Panagiotis Charalampopoulos , Bartłomiej Dudek , Paweł Gawrychowski , Karol Pokorski

Thumbnail PDF


  • Filesize: 0.83 MB
  • 18 pages

Document Identifiers

Author Details

Panagiotis Charalampopoulos
  • Birkbeck, University of London, UK
Bartłomiej Dudek
  • Institute of Computer Science, University of Wrocław, Poland
Paweł Gawrychowski
  • Institute of Computer Science, University of Wrocław, Poland
Karol Pokorski
  • Institute of Computer Science, University of Wrocław, Poland

Cite AsGet BibTex

Panagiotis Charalampopoulos, Bartłomiej Dudek, Paweł Gawrychowski, and Karol Pokorski. Optimal Near-Linear Space Heaviest Induced Ancestors. In 34th Annual Symposium on Combinatorial Pattern Matching (CPM 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 259, pp. 8:1-8:18, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)


We revisit the Heaviest Induced Ancestors (HIA) problem that was introduced by Gagie, Gawrychowski, and Nekrich [CCCG 2013] and has a number of applications in string algorithms. Let T₁ and T₂ be two rooted trees whose nodes have weights that are increasing in all root-to-leaf paths, and labels on the leaves, such that no two leaves of a tree have the same label. A pair of nodes (u, v) ∈ T₁ × T₂ is induced if and only if there is a label shared by leaf-descendants of u and v. In an HIA query, given nodes x ∈ T₁ and y ∈ T₂, the goal is to find an induced pair of nodes (u, v) of the maximum total weight such that u is an ancestor of x and v is an ancestor of y. Let n be the upper bound on the sizes of the two trees. It is known that no data structure of size 𝒪̃(n) can answer HIA queries in o(log n / log log n) time [Charalampopoulos, Gawrychowski, Pokorski; ICALP 2020]. This (unconditional) lower bound is a polyloglog n factor away from the query time of the fastest 𝒪̃(n)-size data structure known to date for the HIA problem [Abedin, Hooshmand, Ganguly, Thankachan; Algorithmica 2022]. In this work, we resolve the query-time complexity of the HIA problem for the near-linear space regime by presenting a data structure that can be built in 𝒪̃(n) time and answers HIA queries in 𝒪(log n/log log n) time. As a direct corollary, we obtain an 𝒪̃(n)-size data structure that maintains the LCS of a static string and a dynamic string, both of length at most n, in time optimal for this space regime. The main ingredients of our approach are fractional cascading and the utilization of an 𝒪(log n/ log log n)-depth tree decomposition. The latter allows us to break through the Ω(log n) barrier faced by previous works, due to the depth of the considered heavy-path decompositions.

Subject Classification

ACM Subject Classification
  • Theory of computation → Pattern matching
  • data structures
  • string algorithms
  • fractional cascading


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Paniz Abedin, Sahar Hooshmand, Arnab Ganguly, and Sharma V. Thankachan. The heaviest induced ancestors problem: Better data structures and applications. Algorithmica, 84(7):2088-2105, 2022. URL: https://doi.org/10.1007/s00453-022-00955-7.
  2. S. Alstrup, T. Husfeldt, and T. Rauhe. Marked ancestor problems. In Proceedings 39th Annual Symposium on Foundations of Computer Science, pages 534-543, 1998. URL: https://doi.org/10.1109/SFCS.1998.743504.
  3. Stephen Alstrup, Jens P. Secher, and Maz Spork. Optimal on-line decremental connectivity in trees. Inf. Process. Lett., 64(4):161-164, 1997. URL: https://doi.org/10.1016/S0020-0190(97)00170-1.
  4. Amihood Amir, Panagiotis Charalampopoulos, Costas S. Iliopoulos, Solon P. Pissis, and Jakub Radoszewski. Longest common factor after one edit operation. In String Processing and Information Retrieval: 24th International Symposium, SPIRE 2017, Proceedings, pages 14-26, 2017. URL: https://doi.org/10.1007/978-3-319-67428-5_2.
  5. Amihood Amir, Panagiotis Charalampopoulos, Solon P. Pissis, and Jakub Radoszewski. Dynamic and internal longest common substring. Algorithmica, 82(12):3707-3743, 2020. URL: https://doi.org/10.1007/s00453-020-00744-0.
  6. Philip Bille, Inge Li Gørtz, Hjalte Wedel Vildhøj, and Søren Vind. String indexing for patterns with wildcards. Theory Comput. Syst., 55(1):41-60, 2014. URL: https://doi.org/10.1007/s00224-013-9498-4.
  7. Gerth Stølting Brodal, Rolf Fagerberg, Christian N. S. Pedersen, and Anna Östlin. The complexity of constructing evolutionary trees using experiments. In Automata, Languages and Programming, 28th International Colloquium, ICALP 2001, pages 140-151, 2001. URL: https://doi.org/10.1007/3-540-48224-5_12.
  8. Panagiotis Charalampopoulos, Paweł Gawrychowski, and Karol Pokorski. Dynamic Longest Common Substring in Polylogarithmic Time. In 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020), pages 27:1-27:19, 2020. URL: https://doi.org/10.4230/LIPIcs.ICALP.2020.27.
  9. Bernard Chazelle and Leonidas Guibas. Fractional cascading: I. A data structuring technique. Algorithmica, 1:133-162, January 1986. URL: https://doi.org/10.1007/BF01840440.
  10. Richard Cole and Ramesh Hariharan. Dynamic LCA queries on trees. SIAM J. Comput., 34(4):894-923, 2005. URL: https://doi.org/10.1137/S0097539700370539.
  11. Erik D. Demaine, Gad M. Landau, and Oren Weimann. On cartesian trees and range minimum queries. Algorithmica, 68(3):610-625, 2014. URL: https://doi.org/10.1007/s00453-012-9683-x.
  12. Johannes Fischer and Pawel Gawrychowski. Alphabet-dependent string searching with wexponential search trees. In Combinatorial Pattern Matching - 26th Annual Symposium, CPM 2015, pages 160-171, 2015. URL: https://doi.org/10.1007/978-3-319-19929-0_14.
  13. Johannes Fischer and Volker Heun. Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM Journal on Computing, 40(2):465-492, 2011. URL: https://doi.org/10.1137/090779759.
  14. Travis Gagie, Paweł Gawrychowski, and Yakov Nekrich. Heaviest induced ancestors and longest common substrings. In Proceedings of the 25th Canadian Conference on Computational Geometry, CCCG 2013, 2013. URL: http://cccg.ca/proceedings/2013/papers/paper_29.pdf.
  15. Davide Della Giustina, Nicola Prezza, and Rossano Venturini. A new linear-time algorithm for centroid decomposition. In String Processing and Information Retrieval - 26th International Symposium, SPIRE 2019, pages 274-282, 2019. URL: https://doi.org/10.1007/978-3-030-32686-9_20.
  16. Dan Gusfield. Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biology. Cambridge University Press, 1997. URL: https://doi.org/10.1017/CBO9780511574931.
  17. Dov Harel and Robert Endre Tarjan. Fast algorithms for finding nearest common ancestors. SIAM J. Comput., 13(2):338-355, 1984. Google Scholar
  18. Donald R. Morrison. Patricia—practical algorithm to retrieve information coded in alphanumeric. J. ACM, 15(4):514-534, October 1968. URL: https://doi.org/10.1145/321479.321481.
  19. Mihai Pătraşcu. Unifying the landscape of cell-probe lower bounds. SIAM J. Comput., 40(3):827-847, 2011. URL: https://doi.org/10.1137/09075336X.
  20. Milan Ružić. Constructing efficient dictionaries in close to sorting time. In Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, pages 84-95, 2008. URL: https://doi.org/10.1007/978-3-540-70575-8_8.
  21. Qingmin Shi and Joseph JáJá. Novel transformation techniques using q-heaps with applications to computational geometry. SIAM J. Comput., 34:1474-1492, January 2005. URL: https://doi.org/10.1137/S0097539703435728.
  22. Peter Weiner. Linear pattern matching algorithms. In 14th FOCS, pages 1-11, 1973. URL: https://doi.org/10.1109/SWAT.1973.13.
  23. Dan E. Willard. Log-logarithmic worst-case range queries are possible in space Θ(n). Information Processing Letters, 17(2):81-84, 1983. URL: https://doi.org/doi.org/10.1016/0020-0190(83)90075-3.
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail