research

Linear-Space Data Structures for Range Mode Query in Arrays

Abstract

A mode of a multiset SS is an element a∈Sa \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(n2βˆ’2Ο΅)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(∣jβˆ’i∣)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.Comment: 13 pages, 2 figure

    Similar works

    Full text

    thumbnail-image

    Available Versions