, Volume 50, Issue 4, pp 584–596

Subquadratic Algorithms for 3SUM


DOI: 10.1007/s00453-007-9036-3

Cite this article as:
Baran, I., Demaine, E.D. & Pǎtraşcu, M. Algorithmica (2008) 50: 584. doi:10.1007/s00453-007-9036-3


We obtain subquadratic algorithms for 3SUM on integers and rationals in several models. On a standard word RAM with w-bit words, we obtain a running time of \(O(n^{2}/\max\{\frac{w}{\lg^{2}w},\frac{\lg^{2}n}{(\lg\lg n)^{2}}\})\) . In the circuit RAM with one nonstandard AC0 operation, we obtain \(O(n^{2}/\frac{w^{2}}{\lg^{2}w})\) . In external memory, we achieve O(n2/(MB)), even under the standard assumption of data indivisibility. Cache-obliviously, we obtain a running time of \(O(n^{2}/\frac{MB}{\lg^{2}M})\) . In all cases, our speedup is almost quadratic in the “parallelism” the model can afford, which may be the best possible. Our algorithms are Las Vegas randomized; time bounds hold in expectation, and in most cases, with high probability.


3SUM Word RAM Randomization 

Copyright information

© Springer Science+Business Media, LLC 2007

Authors and Affiliations

  • Ilya Baran
    • 1
  • Erik D. Demaine
    • 1
  • Mihai Pǎtraşcu
    • 1
  1. 1.MIT Computer Science and Artificial Intelligence LaboratoryCambridgeUSA

Personalised recommendations