Given an array A of n elements, we wish to support queries for the most frequent and least frequent element in a subrange [l, r] of A. We also wish to support updates that change a particular element at index i or insert/ delete an element at index i. For the range mode problem, our data structure supports all operations in O(n 2 3) deterministic time using only O(n) space. This improves two results by Chan et al. [3]: a linear space data structure supporting update and query operations in Õ(n 3 4) time and an O(n 4 3 ) space data structure supporting update and query operations in Õ(n 2 3) time. For the range least frequent problem, we address two variations. In the first, we are allowed to answer with an element of A that may not appear in the query range, and in the second, the returned element must be present in the query range. For the first variation, we develop a data structure that supports queries in Õ(n 2 3) time, updates in O(n 2 3) time, and occupies O(n) space. For the second variation, we develop a Monte Carlo data structure that supports queries in O(n 2 3) time, updates in Õ(n 2 3 ) time, and occupies Õ(n) space, but requires that updates are made independently of the results of previous queries.The Monte Carlo data structure is also capable of answering k-frequency queries; that is, the problem of finding an element of given frequency in the specified query range. Previously, no dynamic data structures were known for least frequent element or k-frequency queries.
ACM Subject Classification Theory of computation → Data structures design and analysisKeywords and phrases dynamic data structures, range query, range mode, range least frequent, range k-frequency
Let S be a set of n points in an [n] d grid, such that each point is assigned a color. Given a query range, the geometric range mode query problem asks to report the most frequent color (i.e., a mode) of the multiset of colors corresponding to points in S ∩ Q. When d = 1, Chan et al. (STACS 2012 [2]) gave a data structure that requires O(n + (n/∆) 2 /w) words of space and supports range mode queries in O(∆) time for any ∆ ≥ 1, where w = Ω(log n) is the word size. Chan et al. also proposed a data structures for higher dimensions (i.e., d ≥ 2) with O(s n + (n/∆) 2d ) space and O(∆ · t n ) query time, where s n and t n denote the space and query time of a data structure that supports orthogonal range counting queries on the set S. In this paper we show that the space can be improved without any increase to the query time, by presenting an O(s n + (n/∆) 2d /w)-space data structure that supports orthogonal range mode queries on a set of n points in d dimensions in O(∆ · t n ) time, for any ∆ ≥ 1. When d = 1, these space and query time costs match those achieved by the current best known one-dimensional data structure.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.