Dynamic Range Majority Data Structures

  • Amr Elmasry
  • Meng He
  • J. Ian Munro
  • Patrick K. Nicholson
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7074)


Given a set P of n coloured points on the real line, we study the problem of answering range α-majority (or “heavy hitter”) queries on P. More specifically, for a query range Q, we want to return each colour that is assigned to more than an α-fraction of the points contained in Q. We present a new data structure for answering range α-majority queries on a dynamic set of points, where α ∈ (0,1). Our data structure uses O(n) space, supports queries in \(O((\lg n) / \alpha)\) time, and updates in \(O((\lg n) / \alpha)\) amortized time. If the coordinates of the points are integers, then the query time can be improved to \(O(\lg n / (\alpha \lg \lg n))\). For constant values of α, this improved query time matches an existing lower bound, for any data structure with polylogarithmic update time. We also generalize our data structure to handle sets of points in d-dimensions, for d ≥ 2, as well as dynamic arrays, in which each entry is a colour.


Data Structure Query Time Range Counting Dynamic Array Heavy Hitter 
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.
    Andersson, A., Miltersen, P., Thorup, M.: Fusion trees can be implemented with \(\text{AC}^0\) instructions only. Theoretical Computer Science 215(1-2), 337–344 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Arge, L., Vitter, J.S.: Optimal external memory interval management. SIAM J. Comput. 32(6), 1488–1508 (2003)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Bentley, J.: Multidimensional divide-and-conquer. Communications of the ACM 23(4), 214–229 (1980)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Bozanis, P., Kitsios, N., Makris, C., Tsakalidis, A.: New Upper Bounds for Generalized Intersection Searching Problems. In: Fülöp, Z. (ed.) ICALP 1995. LNCS, vol. 944, pp. 464–474. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  5. 5.
    De Berg, M., Haverkort, H.: Significant-presence range queries in categorical data. Algorithms and Data Structures, 462–473 (2003)Google Scholar
  6. 6.
    Demaine, E.D., López-Ortiz, A., Munro, J.I.J.: Frequency Estimation of Internet Packet Streams with Limited Space. In: Möhring, R.H., Raman, R. (eds.) ESA 2002. LNCS, vol. 2461, pp. 348–360. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  7. 7.
    Dietz, P.: Optimal algorithms for list indexing and subset rank. Algorithms and Data Structures, 39–46 (1989)Google Scholar
  8. 8.
    Durocher, S., He, M., Munro, J.I., Nicholson, P.K., Skala, M.: Range Majority in Constant Time and Linear Space. In: Aceto, L., Henzinger, M., Sgall, J. (eds.) ICALP 2011. LNCS, vol. 6755, pp. 244–255. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  9. 9.
    Fredman, M., Willard, D.: Surpassing the information theoretic bound with fusion trees. Journal of Computer and System Sciences 47(3), 424–436 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Gagie, T., Kärkkäinen, J.: Counting Colours in Compressed Strings. In: Giancarlo, R., Manzini, G. (eds.) CPM 2011. LNCS, vol. 6661, pp. 197–207. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  11. 11.
    Gupta, P., Janardan, R., Smid, M.: Further Results on Generalized Intersection Searching Problems: Counting, Reporting, and Dynamization. Journal of Algorithms 19(2), 282–317 (1995)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Husfeldt, T., Rauhe, T.: New lower bound techniques for dynamic partial sums and related problems. SIAM Journal on Computing 32(3), 736–753 (2003)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Karp, R., Shenker, S., Papadimitriou, C.: A simple algorithm for finding frequent elements in streams and bags. ACM TODS 28(1), 51–55 (2003)CrossRefGoogle Scholar
  14. 14.
    Karpinski, M., Nekrich, Y.: Searching for frequent colors in rectangles. In: Proc. CCCG, pp. 11–14 (2008),
  15. 15.
    Lai, Y., Poon, C., Shi, B.: Approximate colored range and point enclosure queries. Journal of Discrete Algorithms 6(3), 420–432 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Misra, J., Gries, D.: Finding repeated elements. Science of Computer Programming 2(2), 143–152 (1982)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Wei, Z., Yi, K.: Beyond simple aggregates: indexing for summary queries. In: Proc. PODS, pp. 117–128. ACM (2011)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Amr Elmasry
    • 1
  • Meng He
    • 2
  • J. Ian Munro
    • 3
  • Patrick K. Nicholson
    • 3
  1. 1.Department of Computer ScienceUniversity of CopenhagenDenmark
  2. 2.Faculty of Computer ScienceDalhousie UniversityCanada
  3. 3.David R. Cheriton School of Computer ScienceUniversity of WaterlooCanada

Personalised recommendations