Advertisement

Optimal Query Time for Encoding Range Majority

  • Paweł Gawrychowski
  • Patrick K. Nicholson
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10389)

Abstract

We revisit the range \(\tau \)-majority problem, which asks us to preprocess an array \(\mathsf {A}[1..n]\) for a fixed value of \(\tau \in (0,\frac{1}{2}]\), such that for any query range [ij] we can return a position in \(\mathsf {A}\) of each distinct \(\tau \)-majority element. A \(\tau \)-majority element is one that has relative frequency at least \(\tau \) in the range [ij]: i.e., frequency at least \(\tau (j-i+1)\). Belazzougui et al. [WADS 2013] presented a data structure that can answer such queries in \(\mathcal {O}(1/\tau )\) time, which is optimal, but the space can be as much as \(\Theta (n \lg n)\) bits. Recently, Navarro and Thankachan [Algorithmica 2016] showed that this problem could be solved using an \(\mathcal {O}(n \lg (1/\tau ))\) bit encoding, which is optimal in terms of space, but has suboptimal query time. In this paper, we close this gap and present a data structure that occupies \(\mathcal {O}(n \lg (1/\tau ))\) bits of space, and has \(\mathcal {O}(1/\tau )\) query time. We also show that this space bound is optimal, even for the much weaker query in which we must decide whether the query range contains at least one \(\tau \)-majority element.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Belazzougui, D., Gagie, T., Munro, J.I., Navarro, G., Nekrich, Y.: Range majorities and minorities in arrays. CoRR abs/1606.04495 (2016)Google Scholar
  2. 2.
    Belazzougui, D., Gagie, T., Navarro, G.: Better space bounds for parameterized range majority and minority. In: Dehne, F., Solis-Oba, R., Sack, J.-R. (eds.) WADS 2013. LNCS, vol. 8037, pp. 121–132. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-40104-6_11 CrossRefGoogle Scholar
  3. 3.
    Boyer, R.S., Moore, J.S.: MJRTY: A fast majority vote algorithm. In: Automated Reasoning: Essays in Honor of Woody Bledsoe, pp. 105–118. Automated Reasoning Series. Kluwer Academic Publishers (1991)Google Scholar
  4. 4.
    Chan, T.M., Durocher, S., Larsen, K.G., Morrison, J., Wilkinson, B.T.: Linear-space data structures for range mode query in arrays. Theory Comput. Syst. 55(4), 719–741 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Demaine, E.D., López-Ortiz, A., Munro, J.I.: Frequency estimation of internet packet streams with limited space. In: Möhring, R., Raman, R. (eds.) ESA 2002. LNCS, vol. 2461, pp. 348–360. Springer, Heidelberg (2002). doi: 10.1007/3-540-45749-6_33 CrossRefGoogle Scholar
  6. 6.
    Durocher, S., He, M., Munro, J.I., Nicholson, P.K., Skala, M.: Range majority in constant time and linear space. Inf. Comput. 222, 169–179 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Ferragina, P., Venturini, R.: A simple storage scheme for strings achieving entropy bounds. Theor. Comput. Sci. 372(1), 115–121 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Gagie, T., He, M., Munro, J.I., Nicholson, P.K.: Finding frequent elements in compressed 2D arrays and strings. In: Grossi, R., Sebastiani, F., Silvestri, F. (eds.) SPIRE 2011. LNCS, vol. 7024, pp. 295–300. Springer, Heidelberg (2011). doi: 10.1007/978-3-642-24583-1_29 CrossRefGoogle Scholar
  9. 9.
    Gawrychowski, P., Nicholson, P.K.: Optimal query time for encoding range majority (2017). CoRR arXiv:1704.06149
  10. 10.
    González, R., Navarro, G.: Statistical encoding of succinct data structures. In: Lewenstein, M., Valiente, G. (eds.) CPM 2006. LNCS, vol. 4009, pp. 294–305. Springer, Heidelberg (2006). doi: 10.1007/11780441_27 CrossRefGoogle Scholar
  11. 11.
    Grossi, R., Gupta, A., Vitter, J.S.: High-order entropy-compressed text indexes. In: Proc. SODA 2003, pp. 841–850. ACM/SIAM (2003)Google Scholar
  12. 12.
    Karp, R.M., Shenker, S., Papadimitriou, C.H.: A simple algorithm for finding frequent elements in streams and bags. ACM Trans. Database Syst. 28, 51–55 (2003)CrossRefGoogle Scholar
  13. 13.
    Karpinski, M., Nekrich, Y.: Searching for frequent colors in rectangles. In: Proc. CCCG 2008 (2008)Google Scholar
  14. 14.
    Misra, J., Gries, D.: Finding repeated elements. Sci. Comput. Program. 2(2), 143–152 (1982)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Navarro, G., Thankachan, S.V.: Optimal encodings for range majority queries. Algorithmica 74(3), 1082–1098 (2016)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Patrascu, M.: Succincter. In: Proc. FOCS 2008, pp. 305–313. IEEE (2008)Google Scholar
  17. 17.
    Raman, R.: Encoding Data Structures. In: Rahman, M.S., Tomita, E. (eds.) WALCOM 2015. LNCS, vol. 8973, pp. 1–7. Springer, Cham (2015). doi: 10.1007/978-3-319-15612-5_1 CrossRefGoogle Scholar
  18. 18.
    Raman, R., Raman, V., Satti, S.R.: Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Trans. Algorithms 3(4), 43 (2007)MathSciNetCrossRefGoogle Scholar
  19. 19.
    Skala, M.: Array range queries. In: Brodnik, A., López-Ortiz, A., Raman, V., Viola, A. (eds.) Space-Efficient Data Structures, Streams, and Algorithms. LNCS, vol. 8066, pp. 333–350. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-40273-9_21 CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.Israel and Nokia Bell LabsUniversity of HaifaHaifaIreland

Personalised recommendations