Skip to main content
Log in

Subquadratic Algorithms for 3SUM

  • Published:
Algorithmica Aims and scope Submit manuscript

Abstract

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 AC 0 operation, we obtain \(O(n^{2}/\frac{w^{2}}{\lg^{2}w})\) . In external memory, we achieve O(n 2/(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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aggarwal, A., Vitter, J.S.: The input/output complexity of sorting and related problems. Commun. ACM 31(9), 1116–1127 (1988)

    Article  MathSciNet  Google Scholar 

  2. Albers, S., Hagerup, T.: Improved parallel integer sorting without concurrent writing. In: Proc. 3rd ACM/SIAM Symposium on Discrete Algorithms (SODA), pp. 463–472 (1992)

  3. Andersson, A., Miltersen, P.B., Riis, S., Thorup, M.: Static dictionaries on AC 0 RAMs: query time \(\Theta(\sqrt{\log n/\log\log n})\) is necessary and sufficient. In: Proc. 37th IEEE Symposium on Foundations of Computer Science (FOCS), pp. 441–450 (1996)

  4. Andersson, A., Miltersen, P.B., Thorup, M.: Fusion trees can be implemented with AC 0 instructions only. Theor. Comput. Sci. 215(1–2), 337–344 (1999)

    Article  MATH  MathSciNet  Google Scholar 

  5. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn. MIT Press and McGraw-Hill (2001)

  6. Demaine, E.D.: Cache-oblivious algorithms and data structures. In: Lecture Notes from the EEF Summer School on Massive Data Sets, BRICS, University of Aarhus, Denmark, LNCS

  7. Dietzfelbinger, M.: Universal hashing and k-wise independent random variables via integer arithmetic without primes. In: Proc. 13th Symposium on Theoretical Aspects of Computer Science (STACS), pp. 569–580 (1996)

  8. Erickson, J.: Bounds for linear satisfiability problems. Chic. J. Theor. Comput. Sci. (1999)

  9. Fredman, M.L., Willard, D.E.: Surpassing the information theoretic bound with fusion trees. J. Comput. Syst. Sci. 47(3), 424–436 (1993). See also STOC’90

    Article  MATH  MathSciNet  Google Scholar 

  10. Gajentaan, A., Overmars, M.H.: On a class of O(n 2) problems in computational geometry. Comput. Geom. Theory Appl. 5, 165–185 (1995)

    MATH  MathSciNet  Google Scholar 

  11. Thorup, M.: Randomized sorting in O(nlog log n) time and linear space using addition, shift, and bit-wise boolean operations. J. Algorithms 42(2), 205–230 (2002). See also SODA’97

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Erik D. Demaine.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Baran, I., Demaine, E.D. & Pǎtraşcu, M. Subquadratic Algorithms for 3SUM. Algorithmica 50, 584–596 (2008). https://doi.org/10.1007/s00453-007-9036-3

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00453-007-9036-3

Keywords

Navigation