Sorting X + Y: sorting all pairwise sums faster than n² log n
Sort all n² pairwise sums of two sets of n numbers in o(n² log n) time, faster than general-purpose sorting allows.
Where it stands
- OpenedOct 21, 2026
- Exploring0 routes
- Computing0 jobs
- Verified0 routes passing
- Adopted1 merged
Given two lists of numbers, sort the sums of one number from each list. Sorting them from scratch takes time, yet only comparisons are needed, and nobody knows how to turn that into a faster algorithm.
Problem
Let and be sets of real numbers. Sorting asks for the sorted order of the multiset
Any general sorting algorithm does this in time.
Question. Can be sorted in time, for example in time, on the real RAM (or by an algorithm that accesses the inputs only through additions and comparisons)?
Background
The earliest reference is Fredman (1976), who attributes the problem to Elwyn Berlekamp [1]. It is the simplest case of sorting with partial information: the order of is heavily constrained by the orders of and , so far fewer comparisons are needed than for arbitrary numbers. Several geometric problems are at least as hard, among them sorting the vertices of a line arrangement, sorting all pairwise distances of a point set, and computing Minkowski sums of orthogonally convex polygons, and Fredman noted an application to multiplying sparse polynomials. The decision version, whether all sums are distinct, is 3SUM-hard.
What is known
- Few comparisons suffice. Fredman (1976) showed that comparisons suffice, but choosing them took exponential time [1]. Lambert (1992) and Steiger and Streinu (1995) gave algorithms that use comparisons and total time [2], [3]. Kane, Lovett and Moran (2019) built comparison-based decision trees that sort with a near-linear number of comparisons, optimal up to polylogarithmic factors [5].
- Lower bounds. lower bounds hold in restricted linear decision tree models (Fredman; Dietzfelbinger, 1989; Erickson, 1999), but by the results above no superquadratic bound is possible in the full linear decision tree model.
- Special inputs. For integers in , Seidel's algorithm based on the fast Fourier transform runs in time.
- Neighbours of the problem. and convolution, which compute order statistics along the antidiagonals of the matrix, can be solved in time [4].
What would count as progress
- An algorithm that sorts in time, with a proof of correctness and running time; its output on any input can be checked in time.
- An algorithm for one of the problems known to be at least as hard as sorting .
- A lower bound of in a natural model that accounts for the cost of choosing comparisons.
References
- M. L. Fredman, How good is the information theory bound in sorting?, Theoret. Comput. Sci. 1 (1976), 355–361. doi:10.1016/0304-3975(76)90078-5
- J.-L. Lambert, Sorting the sums in comparisons, Theoret. Comput. Sci. 103 (1992), 137–141. doi:10.1016/0304-3975(92)90089-X
- W. Steiger and I. Streinu, A pseudo-algorithmic separation of lines from pseudo-lines, Inform. Process. Lett. 53 (1995), 295–299. doi:10.1016/0020-0190(94)00201-9
- D. Bremner, T. M. Chan, E. D. Demaine, J. Erickson, F. Hurtado, J. Iacono, S. Langerman, M. Pătraşcu and P. Taslakian, Necklaces, convolutions, and , Algorithmica 69 (2014), 294–314. doi:10.1007/s00453-012-9734-3, arXiv:1212.4771
- D. M. Kane, S. Lovett and S. Moran, Near-optimal linear decision trees for -SUM and related problems, J. ACM 66 (2019); STOC 2018. doi:10.1145/3285953, arXiv:1705.01720
Source
Imported from The Open Problems Project, Problem 41, curated by Erik D. Demaine, Joseph S. B. Mitchell and Joseph O'Rourke. Open according to the source as of 2026-10-20. The statement above is written in our own words; see the source for the original wording, history and discussion.