Advertisement

Range Majority in Constant Time and Linear Space

  • Stephane Durocher
  • Meng He
  • J. Ian Munro
  • Patrick K. Nicholson
  • Matthew Skala
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6755)

Abstract

Given an array A of size n, we consider the problem of answering range majority queries: given a query range [i..j] where 1 ≤ i ≤ j ≤ n, return the majority element of the subarray A[i..j] if it exists. We describe a linear space data structure that answers range majority queries in constant time. We further generalize this problem by defining range α-majority queries: given a query range [i..j], return all the elements in the subarray A[i..j] with frequency greater than α(j − i + 1). We prove an upper bound on the number of α-majorities that can exist in a subarray, assuming that query ranges are restricted to be larger than a given threshold. Using this upper bound, we generalize our range majority data structure to answer range α-majority queries in \(O(\frac{1}{\alpha})\) time using \(O(n lg( \frac{1}{\alpha} + 1))\) space, for any fixed α ∈ (0, 1). This result is interesting since other similar range query problems based on frequency have nearly logarithmic lower bounds on query time when restricted to linear space.

Keywords

Constant Time Linear Space Query Range Query Time Range Mode 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aigner, M.: Variants of the majority problem. Discrete Applied Mathematics 137, 3–25 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Alonso, L., Reingold, E.M.: Determining plurality. ACM Transactions on Algorithms 4(3), 26:1–26:19 (2008)MathSciNetGoogle Scholar
  3. 3.
    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
  4. 4.
    Boyer, R.S., Moore, J.S.: MJRTY - A fast majority vote algorithm. In: Boyer, R.S. (ed.) Automated Reasoning: Essays in Honor of Woody Bledsoe. Automated Reasoning Series, pp. 105–117. Kluwer, Dordrecht (1991)CrossRefGoogle Scholar
  5. 5.
    Cormode, G., Muthukrishnan, S.: An improved data stream summary: the count-min sketch and its applications. Journal of Algorithms 55(1), 58–75 (2005)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Dobkin, D., Munro, J.I.: Determining the mode. Theoretical Computer Science 12(3), 255–263 (1980)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Durocher, S., Morrison, J.: Linear-space data structures for range mode query in arrays (2011), arXiv:1101.4068v1Google Scholar
  8. 8.
    Greve, M., Jørgensen, A.G., Larsen, K.D., Truelsen, J.: Cell probe lower bounds and approximations for range mode. In: Abramsky, S., Gavoille, C., Kirchner, C., Meyer auf der Heide, F., Spirakis, P.G. (eds.) ICALP 2010. LNCS, vol. 6198, pp. 605–616. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  9. 9.
    Grossi, R., Gupta, A., Vitter, J.S.: High-order entropy-compressed text indexes. In: Proc. of the 14th Symposium on Discrete Algorithms, pp. 841–850 (2003)Google Scholar
  10. 10.
    Karpinski, M., Nekrich, Y.: Searching for frequent colors in rectangles. In: Proc. of the 20th Canadian Conference on Computational Geometry, pp. 11–14 (2008)Google Scholar
  11. 11.
    Krizanc, D., Morin, P., Smid, M.: Range mode and range median queries on lists and trees. Nordic Journal of Computing 12, 1–17 (2005)MathSciNetzbMATHGoogle Scholar
  12. 12.
    Misra, J., Gries, D.: Finding repeated elements. Science of Computer Programming 2(2), 143–152 (1982)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Munro, J.I., Spira, M.: Sorting and searching in multisets. SIAM Journal on Computing 5(1), 1–8 (1976)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    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
  15. 15.
    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
  16. 16.
    Skiena, S.: The Algorithm Design Manual, 2nd edn. Springer, Heidelberg (2008)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Stephane Durocher
    • 1
  • Meng He
    • 2
  • J. Ian Munro
    • 2
  • Patrick K. Nicholson
    • 2
  • Matthew Skala
    • 1
  1. 1.Department of Computer ScienceUniversity of ManitobaCanada
  2. 2.Cheriton School of Computer ScienceUniversity of WaterlooCanada

Personalised recommendations