pith. sign in

arxiv: 0901.1761 · v1 · submitted 2009-01-13 · 💻 cs.DS

Towards Optimal Range Medians

classification 💻 cs.DS
keywords rangearrayalgorithmintervalslogarithmicmedianqueriesalgorithms
0
0 comments X
read the original abstract

We consider the following problem: given an unsorted array of $n$ elements, and a sequence of intervals in the array, compute the median in each of the subarrays defined by the intervals. We describe a simple algorithm which uses O(n) space and needs $O(n\log k + k\log n)$ time to answer the first $k$ queries. This improves previous algorithms by a logarithmic factor and matches a lower bound for $k=O(n)$. Since the algorithm decomposes the range of element values rather than the array, it has natural generalizations to higher dimensional problems -- it reduces a range median query to a logarithmic number of range counting queries.

This paper has not been read by Pith yet.

discussion (0)

Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.