Short answer: This is open.
More detail:
Model. A “sorting network” here means a fixed (oblivious) comparator network: the sequence of compare–exchange operations does not depend on the input. One can specialize such a network to compute only the median (or, more generally, the k-th order statistic), often called a selection network.
Upper bounds. The best general deterministic constructions for exact selection in comparator networks have size O(n log k), where k is the number of selected items (so for median, k ≈ n/2 and the bound is O(n log n)). This can be obtained, for example, by using standard sorting networks (Batcher, AKS, or more practical near-AKS constructions) and ignoring all outputs except the middle one, or by dedicated selection/compaction networks from the literature on cardinality/selection constraints. Depth can be O(log n) (e.g., AKS), but the size remains O(n log n).
Lower bounds. Beyond the trivial Ω(n) bound (you must “touch” each input a constant number of times), no superlinear lower bound is known for computing the exact median (or even majority) with comparator networks. In particular, on 0–1 inputs, median coincides with the majority function, and it is a long-standing open problem whether majority (hence median) admits linear-size comparator circuits. Thus we do not know whether O(n) comparators suffice, and we also do not know any Ω(n log n) lower bound for median/majority in this model.
References and context.
About your remark (max-only comparators):
Summary: As of current knowledge, there is no known linear-size comparator (sorting) network that finds the exact median, and no result ruling one out; the problem remains open. The best general bounds are Θ(n log n) size and O(log n) depth.
Was this answer helpful?
version: gpt-5-2025-08-07
Status: UQ Validated
Validated: 7 months ago
Status: Needs Human Verification
Loading model reviews...
Loading reviews...