English

Linear-Space Data Structures for Range Mode Query in Arrays

Data Structures and Algorithms 2011-01-24 v1

Abstract

A mode of a multiset SS is an element aSa \in S of maximum multiplicity; that is, aa occurs at least as frequently as any other element in SS. Given a list A[1:n]A[1:n] of nn items, we consider the problem of constructing a data structure that efficiently answers range mode queries on AA. Each query consists of an input pair of indices (i,j)(i, j) for which a mode of A[i:j]A[i:j] must be returned. We present an O(n22ϵ)O(n^{2-2\epsilon})-space static data structure that supports range mode queries in O(nϵ)O(n^\epsilon) time in the worst case, for any fixed ϵ[0,1/2]\epsilon \in [0,1/2]. When ϵ=1/2\epsilon = 1/2, this corresponds to the first linear-space data structure to guarantee O(n)O(\sqrt{n}) query time. We then describe three additional linear-space data structures that provide O(k)O(k), O(m)O(m), and O(ji)O(|j-i|) query time, respectively, where kk denotes the number of distinct elements in AA and mm denotes the frequency of the mode of AA. Finally, we examine generalizing our data structures to higher dimensions.

Keywords

Cite

@article{arxiv.1101.4068,
  title  = {Linear-Space Data Structures for Range Mode Query in Arrays},
  author = {Stephane Durocher and Jason Morrison},
  journal= {arXiv preprint arXiv:1101.4068},
  year   = {2011}
}

Comments

13 pages, 2 figures

R2 v1 2026-06-21T17:14:51.989Z