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 [i, j] 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 [i, j]: 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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Belazzougui, D., Gagie, T., Munro, J.I., Navarro, G., Nekrich, Y.: Range majorities and minorities in arrays. CoRR abs/1606.04495 (2016)
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
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)
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)
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
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)
Ferragina, P., Venturini, R.: A simple storage scheme for strings achieving entropy bounds. Theor. Comput. Sci. 372(1), 115–121 (2007)
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
Gawrychowski, P., Nicholson, P.K.: Optimal query time for encoding range majority (2017). CoRR arXiv:1704.06149
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
Grossi, R., Gupta, A., Vitter, J.S.: High-order entropy-compressed text indexes. In: Proc. SODA 2003, pp. 841–850. ACM/SIAM (2003)
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)
Karpinski, M., Nekrich, Y.: Searching for frequent colors in rectangles. In: Proc. CCCG 2008 (2008)
Misra, J., Gries, D.: Finding repeated elements. Sci. Comput. Program. 2(2), 143–152 (1982)
Navarro, G., Thankachan, S.V.: Optimal encodings for range majority queries. Algorithmica 74(3), 1082–1098 (2016)
Patrascu, M.: Succincter. In: Proc. FOCS 2008, pp. 305–313. IEEE (2008)
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
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)
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
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Gawrychowski, P., Nicholson, P.K. (2017). Optimal Query Time for Encoding Range Majority. In: Ellen, F., Kolokolova, A., Sack, JR. (eds) Algorithms and Data Structures. WADS 2017. Lecture Notes in Computer Science(), vol 10389. Springer, Cham. https://doi.org/10.1007/978-3-319-62127-2_35
Download citation
DOI: https://doi.org/10.1007/978-3-319-62127-2_35
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-62126-5
Online ISBN: 978-3-319-62127-2
eBook Packages: Computer ScienceComputer Science (R0)