English

On Approximate Range Mode and Range Selection

Data Structures and Algorithms 2019-07-22 v1

Abstract

For any ϵ(0,1)\epsilon \in (0,1), a (1+ϵ)(1+\epsilon)-approximate range mode query asks for the position of an element whose frequency in the query range is at most a factor (1+ϵ)(1+\epsilon) smaller than the true mode. For this problem, we design an O(n/ϵ)O(n/\epsilon) bit data structure supporting queries in O(lg(1/ϵ))O(\lg(1/\epsilon)) time. This is an encoding data structure which does not require access to the input sequence; we prove the space cost is asymptotically optimal for constant ϵ\epsilon. Our solution improves the previous best result of Greve et al. (Cell Probe Lower Bounds and Approximations for Range Mode, ICALP'10) by reducing the space cost by a factor of lgn\lg n while achieving the same query time. We also design an O(n)O(n)-word dynamic data structure that answers queries in O(lgn/lglgn)O(\lg n /\lg\lg n) time and supports insertions and deletions in O(lgn)O(\lg n) time, for any constant ϵ(0,1)\epsilon \in (0,1). This is the first result on dynamic approximate range mode; it can also be used to obtain the first static data structure for approximate 3-sided range mode queries in two dimensions. We also consider approximate range selection. For any α(0,1/2)\alpha \in (0,1/2), an α\alpha-approximate range selection query asks for the position of an element whose rank in the query range is in [kαs,k+αs][k - \alpha s, k + \alpha s], where kk is a rank given by the query and ss is the size of the query range. When α\alpha is a constant, we design an O(n)O(n)-bit encoding data structure that can answer queries in constant time and prove this space cost is asymptotically optimal. The previous best result by Krizanc et al. (Range Mode and Range Median Queries on Lists and Trees, Nordic Journal of Computing, 2005) uses O(nlgn)O(n\lg n) bits, or O(n)O(n) words, to achieve constant approximation for range median only. Thus we not only improve the space cost, but also provide support for any arbitrary kk given at query time.

Keywords

Cite

@article{arxiv.1907.08579,
  title  = {On Approximate Range Mode and Range Selection},
  author = {Hicham El-Zein and Meng He and J. Ian Munro and Yakov Nekrich and Bryce Sandlund},
  journal= {arXiv preprint arXiv:1907.08579},
  year   = {2019}
}