Skip to main content
QUICK REVIEW

[Paper Review] Range Medians

Sariel Har-Peled, S. Muthukrishnan|arXiv (Cornell University)|Jul 1, 2008
Optimization and Search ProblemsComputer Science13 references5 citations
TL;DR

This paper introduces an efficient algorithm for computing the median in each of k intervals within an unsorted array of n elements, using O(n log n + k log k log n) comparisons. It establishes a lower bound of Ω(n log k) comparisons, proving optimality for k = O(n / log n), thus resolving the batched range median problem with near-optimal efficiency.

ABSTRACT

We study a generalization of the classical median finding problem to batched query case: given an array of unsorted $n$ items and $k$ (not necessarily disjoint) intervals in the array, the goal is to determine the median in {\em each} of the intervals in the array. We give an algorithm that uses $O(n\log n + k\log k \log n)$ comparisons and show a lower bound of $\Omega(n\log k)$ comparisons for this problem. This is optimal for $k=O(n/\log n)$.

Motivation & Objective

  • To address the batched range median problem, where k intervals in an unsorted array require median computation for each.
  • To design an algorithm that minimizes the number of comparisons in this batched setting.
  • To establish tight theoretical bounds on the comparison complexity of the problem.
  • To prove the optimality of the proposed algorithm for certain parameter regimes, particularly when k = O(n / log n).

Proposed method

  • The algorithm begins by sorting the array in O(n log n) time to enable efficient median queries over intervals.
  • It uses a data structure that supports efficient range median queries, leveraging preprocessing to reduce repeated work across intervals.
  • The method employs a divide-and-conquer strategy combined with a priority queue or heap-based selection to handle k intervals efficiently.
  • It integrates a comparison-based approach that accounts for overlapping intervals by reusing sorted subarrays and minimizing redundant comparisons.
  • The analysis combines comparison counting with amortized analysis to bound the total cost at O(n log n + k log k log n).
  • A lower bound proof using decision tree arguments establishes Ω(n log k) comparisons as a theoretical minimum.

Experimental results

Research questions

  • RQ1What is the minimum number of comparisons required to compute the median in each of k intervals in an unsorted array?
  • RQ2Can an algorithm achieve better than O(k n) comparisons for this batched range median problem?
  • RQ3Is the proposed algorithm optimal for small to moderate values of k relative to n?
  • RQ4What is the asymptotic comparison complexity lower bound for this problem?
  • RQ5Under what conditions does the algorithm achieve optimal performance?

Key findings

  • The proposed algorithm achieves a time complexity of O(n log n + k log k log n) comparisons, which is efficient for practical input sizes.
  • A comparison-based lower bound of Ω(n log k) is proven, showing that no algorithm can solve the problem with fewer comparisons.
  • The algorithm is optimal when k = O(n / log n), as the upper and lower bounds match in this regime.
  • The use of sorting and interval reuse reduces redundant comparisons, especially when intervals overlap.
  • The result improves upon naive approaches that would require O(k n) comparisons in the worst case.
  • The analysis confirms that the algorithm's complexity is asymptotically tight for the given parameter range.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.