Better space bounds for parameterized range majority and minority

  • Authors:
  • Djamal Belazzougui;Travis Gagie;Gonzalo Navarro

  • Affiliations:
  • Department of Computer Science, University of Helsinki, Finland;Department of Computer Science, University of Helsinki, Finland,Helsinki Institute for Information Technology, Finland;Department of Computer Science, University of Chile, Chile

  • Venue:
  • WADS'13 Proceedings of the 13th international conference on Algorithms and Data Structures
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

Karpinski and Nekrich (2008) introduced the problem of parameterized range majority, which asks to preprocess a string of length n such that, given the endpoints of a range, one can quickly find all the distinct elements whose relative frequencies in that range are more than a threshold τ. Subsequent authors have reduced their time and space bounds such that, when τ is given at preprocessing time, we need either $\mathcal{O}\!\left( {n \lg (1 / \tau) } \right)$ space and optimal $\mathcal{O}\!\left( {1 / \tau} \right)$ query time or linear space and $\mathcal{O}\!\left( {(1 / \tau) \lg \lg \sigma} \right)$ query time, where σ is the alphabet size. In this paper we give the first linear-space solution with optimal $\mathcal{O}\!\left( {1 / \tau} \right)$ query time. For the case when τ is given at query time, we significantly improve previous bounds, achieving either $\mathcal{O}\!\left( {n \lg \lg \sigma} \right)$ space and optimal $\mathcal{O}\!\left( {1 / \tau} \right)$ query time or compressed space and $\mathcal{O}\!\left( {(1 / \tau) \lg \frac{\lg (1 / \tau)}{\lg \lg n}} \right)$ query time. Along the way, we consider the complementary problem of parameterized range minority that was recently introduced by Chan et al. (2012), who achieved linear space and $\mathcal{O}\!\left( {1 / \tau} \right)$ query time even for variable τ. We improve their solution to use either nearly optimally compressed space with no slowdown, or optimally compressed space with nearly no slowdown. Some of our intermediate results, such as density-sensitive query time for one-dimensional range counting, may be of independent interest.