Tree Path Majority Data Structures

Authors Travis Gagie, Meng He, Gonzalo Navarro

Thumbnail PDF


  • Filesize: 441 kB
  • 12 pages

Document Identifiers

Author Details

Travis Gagie
  • CeBiB - Center for Biotechnology and Bioengineering, Chile, School of Computer Science and Telecommunications, Diego Portales University, Chile
Meng He
  • Faculty of Computer Science, Dalhousie University, Canada
Gonzalo Navarro
  • CeBiB - Center for Biotechnology and Bioengineering, Chile, IMFD - Millenium Institute for Foundational Research on Data, Chile, Dept. of Computer Science, University of Chile, Chile

Cite AsGet BibTex

Travis Gagie, Meng He, and Gonzalo Navarro. Tree Path Majority Data Structures. In 29th International Symposium on Algorithms and Computation (ISAAC 2018). Leibniz International Proceedings in Informatics (LIPIcs), Volume 123, pp. 68:1-68:12, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2018)


We present the first solution to tau-majorities on tree paths. Given a tree of n nodes, each with a label from [1..sigma], and a fixed threshold 0<tau<1, such a query gives two nodes u and v and asks for all the labels that appear more than tau * |P_{uv}| times in the path P_{uv} from u to v, where |P_{uv}| denotes the number of nodes in P_{uv}. Note that the answer to any query is of size up to 1/tau. On a w-bit RAM, we obtain a linear-space data structure with O((1/tau)lg^* n lg lg_w sigma) query time. For any kappa > 1, we can also build a structure that uses O(n lg^{[kappa]} n) space, where lg^{[kappa]} n denotes the function that applies logarithm kappa times to n, and answers queries in time O((1/tau)lg lg_w sigma). The construction time of both structures is O(n lg n). We also describe two succinct-space solutions with the same query time of the linear-space structure. One uses 2nH + 4n + o(n)(H+1) bits, where H <=lg sigma is the entropy of the label distribution, and can be built in O(n lg n) time. The other uses nH + O(n) + o(nH) bits and is built in O(n lg n) time w.h.p.

Subject Classification

ACM Subject Classification
  • Theory of computation → Data structures design and analysis
  • Majorities on Trees
  • Succinct data structures


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


  1. D. Belazzougui, T. Gagie, J. I. Munro, G. Navarro, and Y. Nekrich. Range Majorities and Minorities in Arrays. CoRR, abs/1606.04495, 2016. URL:
  2. D. Belazzougui, T. Gagie, and G. Navarro. Better Space Bounds for Parameterized Range Majority and Minority. In Proc. 12th WADS, LNCS 8037, pages 121-132, 2013. Google Scholar
  3. D. Belazzougui and G. Navarro. Alphabet-Independent Compressed Text Indexing. ACM Trans. Alg., 10(4):article 23, 2014. Google Scholar
  4. D. Belazzougui and G. Navarro. Optimal Lower and Upper Bounds for Representing Sequences. ACM Trans. Alg., 11(4):article 31, 2015. Google Scholar
  5. T. C. Bell, J. Cleary, and I. H. Witten. Text Compression. Prentice Hall, 1990. Google Scholar
  6. M. Bender and M. Farach-Colton. The level ancestor problem simplified. Theor. Comp. Sci., 321(1):5-12, 2004. Google Scholar
  7. M. A. Bender, M. Farach-Colton, G. Pemmasani, S. Skiena, and P. Sumazin. Lowest common ancestors in trees and directed acyclic graphs. J. Algorithms, 57(2):75-94, 2005. Google Scholar
  8. T. M. Chan, S. Durocher, K. G. Larsen, J. Morrison, and B. T. Wilkinson. Linear-Space Data Structures for Range Mode Query in Arrays. Theor. Comp. Syst., 55(4):719-741, 2014. Google Scholar
  9. D. R. Clark. Compact PAT Trees. PhD thesis, University of Waterloo, Canada, 1996. Google Scholar
  10. E. D. Demaine, A. López-Ortiz, and J. I. Munro. Frequency Estimation of Internet Packet Streams with Limited Space. In Proc. 10th ESA, pages 348-360, 2002. Google Scholar
  11. S. Durocher, R. Shah, M. Skala, and S. V. Thankachan. Linear-space data structures for range frequency queries on arrays and trees. Algorithmica, 74(1):344-366, 2016. Google Scholar
  12. M. Fang, N. Shivakumar, H. Garcia-Molina, R. Motwani, and J. D. Ullman. Computing Iceberg Queries Efficiently. In Proc. 24th VLDB, pages 299-310, 1998. Google Scholar
  13. T. Gagie, M. He, J. I. Munro, and P. K. Nicholson. Finding Frequent Elements in Compressed 2D Arrays and Strings. In Proc. 18th SPIRE, pages 295-300, 2011. Google Scholar
  14. M. He, J. I. Munro, and G. Zhou. A Framework for Succinct Labeled Ordinal Trees over Large Alphabets. Algorithmica, 70(4):696-717, 2014. Google Scholar
  15. D. Krizanc, P. Morin, and M. H. M. Smid. Range mode and range median queries on lists and trees. Nordic J. Comp., 12(1):1-17, 2005. Google Scholar
  16. J. Misra and D. Gries. Finding Repeated Elements. Sci. Comp. Prog., 2(2):143-152, 1982. Google Scholar
  17. G. Navarro and K. Sadakane. Fully-Functional Static and Dynamic Succinct Trees. ACM Trans. Alg., 10(3):article 16, 2014. Google Scholar
  18. R. Raman, V. Raman, and S. S. Rao. Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Trans. Alg., 3(4):article 43, 2007. Google Scholar
  19. L. Russo, G. Navarro, and A. Oliveira. Fully-Compressed Suffix Trees. ACM Trans. Alg., 7(4):article 53, 2011. Google Scholar
  20. D. Sleator and R. E. Tarjan. A data structure for dynamic trees. J. Comp. Sys. Sci., 26(3):362-391, 1983. Google Scholar
  21. D. Tsur. Succinct representation of labeled trees. Theor. Comp. Sci., 562:320-329, 2014. Google Scholar