Skip to content
DAH

Generalized sorting: is n·polylog n comparisons enough, and what is the exact complexity?

OpenTo verify: Expert reviewPosed by Huang, Kannan and Khanna, FOCS 2011 (building on Charikar et al., 2000)
AI-reviewed
On this page15 sections
Difficulty
28/100Engineering
How far from a resolution. P vs NP = 100
Application value
12/100Theoretical
Realistic practical impact if resolved. P vs NP = 100
Leverage
15/100Isolated
How much other knowledge hinges on it. P vs NP = 100

Difficulty 28: a complete claimed randomized O(n log^4 n) algorithm exists, so the question of Huang, Kannan and Khanna may be settled once it is checked, but it is an unrefereed preprint under two days old, and the O(n log n) question, deterministic algorithms and lower bounds above n log n remain open; rated slightly above the AKPW spanning-tree entry (22) because more parts stay open. Application value 12: indirect, sharpens query-complexity techniques; direct uses (restricted or costly comparisons) are niche. Leverage 15: a few results in one subfield, restricted-comparison sorting and sorting with predictions.

The problem

Sorting when only some pairs can be compared: can it be nearly as cheap as ordinary sorting? An unrefereed 2026 claim says yes.

  1. 1Only some pairs may be compared
  2. 2Ordinary sorting costs about n log n
  3. 32011 best method: about n to the 3/2
  4. 4Nov 2026 preprints claim near-linear
  5. 5Log factors, determinism still open

The setup. There are nn items with a hidden ranking from smallest to largest, a total order. You also have a graph GG: the items are its vertices, and an edge between two items means you may ask which of the two is smaller. You never learn anything about a pair that is not an edge. The graph is promised to contain a Hamiltonian path that visits the items in sorted order; this guarantees that the ranking can be recovered at all. Your cost is the number of questions (comparisons), which you may choose one at a time depending on earlier answers. If GG has every edge, this is ordinary sorting, which needs about nlog⁡2nn\log_2 n comparisons, and no method can beat that. This lower bound is the only one known for the general problem.

The question. For the worst graph, how many comparisons are needed? Asking about every edge costs mm, the number of edges, which can be near n2/2n^2/2. In 2011 Huang, Kannan and Khanna gave a randomized method using about n3/2n^{3/2} comparisons (O~\tilde O hides logarithmic factors) and asked whether the true cost must be at least n1+εn^{1+\varepsilon} for some fixed ε>0\varepsilon>0. Kuszmaul and Narayanan (2021) improved the dependence on mm to mn\sqrt{mn}, which does not help on dense graphs, and solved the case of random graphs with about nlog⁡nn\log n comparisons.

The 2026 claims. Behnezhad and Ferrante (4 November) claim O~(n4/3)\tilde O(n^{4/3}) by asking about edges that lie on many four-cycles: each answer then lets you infer the direction of other edges in those cycles for free. Khanna, Putterman and Song (5 November) claim O(nlog⁡4n)O(n\log^4 n) expected comparisons. Their idea has two stages. First, predict the direction of every edge: sample some edges, find an ordering consistent with the sampled answers, and repeat several passes to remove errors until the prediction is wrong on only about nlog⁡nn\log n edges. Second, repair the prediction: an earlier algorithm of Lu, Ren, Sun and Zhang fixes a prediction with ww wrong edges using O(nlog⁡n+w)O(n\log n+w) comparisons. Randomness enters through the sampling, so the bound is on the expected number of comparisons.

What stays open. Even if the claim is right, a gap of log⁡3n\log^3 n remains between nlog⁡4nn\log^4 n and the lower bound nlog⁡nn\log n. Nobody knows the best deterministic method (one with no random choices), or whether a fast program, not just a small number of questions, can reach near-linear cost; the new paper lists these as open. No lower bound above nlog⁡nn\log n is known for any graph.

Status. Both papers are unrefereed. DARC lists the problem as OPEN, with the Khanna et al. result recorded as a claim under review.

Go deeper

The full technical text.

Items 1,…,n1,\dots,n carry a hidden total order π\pi. A known undirected graph GG on the items contains the Hamiltonian path of π\pi, and a comparison of an edge of GG reveals which endpoint is smaller. Let Q(G)Q(G) be the least (expected, or worst-case for deterministic algorithms) number of comparisons that recovers π\pi, and Q(n)=max⁡GQ(G)Q(n)=\max_G Q(G) over nn-vertex graphs. Huang, Kannan and Khanna asked whether Q(n)≥n1+εQ(n)\ge n^{1+\varepsilon} for some constant ε>0\varepsilon>0. The problem listed here asks for the full picture: is Q(n)=n⋅polylog(n)Q(n)=n\cdot\mathrm{polylog}(n), and what is its exact order? In particular, do O(nlog⁡n)O(n\log n) comparisons suffice for every graph (the only general lower bound is Ω(nlog⁡n)\Omega(n\log n)), what is the deterministic complexity, and can near-linear comparison counts be reached by polynomial-time algorithms?

Words on this page (9)
Words on this page
graph
A set of points (vertices) with some pairs joined by lines (edges).
total order
A ranking in which any two items can be compared, so every item has a definite place in a single line.
comparison sort
A sorting method that learns the order only by asking which of two items is smaller.
Hamiltonian path
A route through a graph that visits every vertex exactly once.
big-O notation
A way to say how fast a quantity grows, ignoring constant factors; O(n log n) grows far slower than n squared.
randomized algorithm
A method that makes random choices, so its cost is judged on average over those choices.
sorting algorithm
A procedure that rearranges a list into order, such as smallest to largest.
preprint
A research paper shared publicly before independent experts have reviewed it, so its claims are not yet confirmed.
tilde-O
Big-O with logarithmic factors hidden, so Õ(n^1.5) means n^1.5 times some power of log n.
New to this? Read first (4)
New to this? Read first
AI-reviewedAn AI drafted this explanation. Check it against the technical text.

Path to understanding

foundations → problem

The research entries this problem rests on, in the order to read them. Each links to its explainer.

  1. Start with
  2. Step 2
  3. Step 3
  4. Then
    • Generalized sorting: is n·polylog n comparisons enough, and what is the exact complexity?The problem

State of the art

Accepted results. Huang, Kannan and Khanna (FOCS 2011) gave a randomized algorithm using O~(min⁡(m,n3/2))\tilde O(\min(m,n^{3/2})) comparisons and asked whether n1+Ω(1)n^{1+\Omega(1)} comparisons are necessary. Kuszmaul and Narayanan (FOCS 2021) proved O~(mn)\tilde O(\sqrt{mn}) for graphs with mm edges and an optimal O(nlog⁡(np))O(n\log(np)) expected bound for Erdos-Renyi graphs with a Hamiltonian path added. Lu, Ren, Sun and Zhang (2020) gave O(nlog⁡n+w)O(n\log n+w) comparisons when a prediction with ww errors is available. The only general lower bound is the Ω(nlog⁡n)\Omega(n\log n) of ordinary sorting.

Claimed improvements (both unrefereed preprints). Behnezhad and Ferrante, arXiv:2611.06745 (v1, 4 November 2026), claim O~(n4/3)\tilde O(n^{4/3}) comparisons on every graph by querying edges that lie in many four-cycles. Khanna, Putterman and Song, arXiv:2611.08397 (v1, 5 November 2026), claim a randomized algorithm with O(nlog⁡4n)O(n\log^4 n) expected comparisons on every graph, which would answer the Huang-Kannan-Khanna question negatively and leave a log⁡3n\log^3 n factor to the sorting lower bound. Their authors report that ChatGPT 6-Astra was essential to the bounds. DARC has not checked either argument, and as of 6 November 2026 the papers are one to two days old.

Why the problem stays open. Even if the 2026 claims hold, the following are not settled: whether O(nlog⁡n)O(n\log n) comparisons suffice on every graph; the deterministic complexity (the new paper lists this as open); whether near-linear query counts are reachable in polynomial time (the algorithm is reported not to be); and any lower bound above Ω(nlog⁡n)\Omega(n\log n) for a specific graph family.

Realistic applications

Direct uses are limited: ranking items when only some pairs can be compared at all or comparisons are expensive, such as tournaments with restricted matchups or costly pairwise tests. The main value is methodological: predicting answers by sampling and then repairing the prediction is a pattern that may carry over to other query-complexity questions.

What counts as solved

A refereed or expert-accepted proof of an upper bound of O(nlog⁡n)O(n\log n) comparisons on every graph (randomized and, separately, deterministic) together with a matching lower bound for some graph family, or a proof that ω(nlog⁡n)\omega(n\log n) comparisons are necessary. Acceptance of the 2026 O(nlog⁡4n)O(n\log^4 n) preprint alone would settle the Huang-Kannan-Khanna question but not this problem.

How it gets verified

To verify: Expert review

Only expert review of the argument is possible today.

Expert review of the Khanna-Putterman-Song argument: the prediction-construction lemma (each phase orients at least half of the remaining edges with O(n) expected errors using O(n log^3 n) queries), the bipartite bounded-degree reduction, the error-isolation passes and the use of the Lu et al. prediction-repair algorithm, checked against the stated bound of O(n log^4 n) expected queries on every graph with a Hamiltonian path. In addition, a consistency check with the Behnezhad-Ferrante four-cycle algorithm, and an implementation that counts queries on adversarial graphs (which can falsify but not prove the bound). Refereed publication or acceptance by specialists in query complexity would settle the claim; the open remainder (O(n log n), determinism, lower bounds) needs new results.

Claims

Connected problems

No connected problems.

Progress

  1. Nov 5, 2026
    Claimed O(n log^4 n) comparisons (preprint)

    Khanna, Putterman and Song posted arXiv:2611.08397 (v1, 5 November 2026). Unrefereed; DARC has not checked it.

    source
  2. Nov 4, 2026
    Claimed Õ(n^(4/3)) via four-cycles (preprint)

    Behnezhad and Ferrante posted arXiv:2611.06745 (v1, 4 November 2026). Unrefereed.

    source
  3. Nov 14, 2021
    Õ(sqrt(mn)) comparisons; optimal for random graphs

    Kuszmaul and Narayanan (FOCS 2021) gave O(n log(np)) expected comparisons for random graphs and Õ(sqrt(mn)) in general.

    source
  4. Oct 31, 2020
    Sorting with predictions: O(n log n + w)

    Lu, Ren, Sun and Zhang showed that a prediction of every edge with w errors can be repaired with O(n log n + w) comparisons, the tool later reused.

    source
  5. Oct 1, 2011
    Generalized sorting in Õ(n^(3/2)) comparisons

    Huang, Kannan and Khanna (FOCS 2011; the date is a placeholder for the symposium month) gave a randomized algorithm using about min(m, n^(3/2)) comparisons and asked whether n^(1+eps) is necessary. Bound as quoted in the later papers cited here.

    source