Range Quantile Queries: Another Virtue of Wavelet Trees

  • Travis Gagie
  • Simon J. Puglisi
  • Andrew Turpin
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5721)


We show how to use a balanced wavelet tree as a data structure that stores a list of numbers and supports efficient range quantile queries. A range quantile query takes a rank and the endpoints of a sublist and returns the number with that rank in that sublist. For example, if the rank is half the sublist’s length, then the query returns the sublist’s median. We also show how these queries can be used to support space-efficient coloured range reporting and document listing.


Binary String Range Mode Distinct Item Left Subtree Wavelet Tree 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Blum, M., Floyd, R.W., Pratt, V.R., Rivest, R.L., Tarjan, R.E.: Time bounds for selection. Journal of Computer and System Sciences 7, 448–461 (1973)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Bose, P., Kranakis, E., Morin, P., Tang, Y.: Approximate range mode and range median queries. In: Diekert, V., Durand, B. (eds.) STACS 2005. LNCS, vol. 3404, pp. 377–388. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  3. 3.
    Chazelle, B.: A functional approach to data structures and its use in multidimensional searching. SIAM Journal on Computing 17, 427–462 (1988)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Clark, D.: Compact PAT trees. PhD thesis, Waterloo University, Canada (1996)Google Scholar
  5. 5.
    Ferragina, P., Giancarlo, R., Manzini, G.: The myriad virtues of wavelet trees. In: Bugliesi, M., Preneel, B., Sassone, V., Wegener, I. (eds.) ICALP 2006. LNCS, vol. 4051, pp. 560–571. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  6. 6.
    Fischer, J.: Efficient Data Structures for String Algorithms. PhD thesis, LMU, München (2007)Google Scholar
  7. 7.
    Gfeller, B., Sanders, P.: Towards optimal range medians. arXiv:0901.1761 (2009)Google Scholar
  8. 8.
    Grossi, R., Gupta, A., Vitter, J.S.: High-order entropy-compressed text indexes. In: Proceedings of the 14th Symposium on Discrete Algorithms, pp. 841–850 (2003)Google Scholar
  9. 9.
    Har-Peled, S., Muthukrishnan, S.M.: Range medians. In: Halperin, D., Mehlhorn, K. (eds.) ESA 2008. LNCS, vol. 5193, pp. 503–514. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  10. 10.
    Jacobson, G.: Space-efficient static trees and graphs. In: Proceedings of the 30th Symposium on Foundations of Computer Science, pp. 549–554 (1989)Google Scholar
  11. 11.
    Krizanc, D., Morin, P., Smid, M.H.M.: Range mode and range median queries on lists and trees. Nordic Journal of Computing 12, 1–17 (2005)MathSciNetzbMATHGoogle Scholar
  12. 12.
    Mäkinen, V., Navarro, G.: Rank and select revisited and extended. Theoretical Computer Science 387, 332–347 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Muthukrishnan, S.: Efficient algorithms for document retrieval problems. In: Proceedings of the 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 657–666 (2002)Google Scholar
  14. 14.
    Navarro, G., Mäkinen, V.: Compressed full text indexes. ACM Computing Surveys 39, Article 2 (2007)Google Scholar
  15. 15.
    Petersen, H.: Improved bounds for range mode and range median queries. In: Geffert, V., Karhumäki, J., Bertoni, A., Preneel, B., Návrat, P., Bieliková, M. (eds.) SOFSEM 2008. LNCS, vol. 4910, pp. 418–423. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  16. 16.
    Petersen, H., Grabowski, S.: Range mode and range median queries in constant time and sub-quadratic space. Information Processing Letters 109, 225–228 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Raman, R., Raman, V., Rao, S.S.: Succinct indexable dictionaries with applications to encoding k-ary trees and multisets. In: Proceedings of the 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 233–242 (2002)Google Scholar
  18. 18.
    Välimäki, N., Mäkinen, V.: Space-efficient algorithms for document retrieval. In: Ma, B., Zhang, K. (eds.) CPM 2007. LNCS, vol. 4580, pp. 205–215. Springer, Heidelberg (2007)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Travis Gagie
    • 1
  • Simon J. Puglisi
    • 2
  • Andrew Turpin
    • 2
  1. 1.Research Group for Combinatorial Algorithms in BioinformaticsBielefeld UniversityGermany
  2. 2.School of Computer Science and Information TechnologyRoyal Melbourne Institute of TechnologyAustralia

Personalised recommendations