Skip to main content
Log in

Improved Subquadratic 3SUM

  • Published:
Algorithmica Aims and scope Submit manuscript

Abstract

In the 3SUM problem we are given three lists \(\mathcal {A}\), \(\mathcal {B}\), \(\mathcal {C}\), of n real numbers, and are asked to find \((a,b,c)\in \mathcal {A}\times \mathcal {B}\times \mathcal {C}\) such that \(a+b=c\). The longstanding 3SUM conjecture—that 3SUM could not be solved in subquadratic time—was recently refuted by Grønlund and Pettie. They presented \(\hbox {O}\left( n^2(\log \log n)^{\alpha }/(\log n)^{\beta }\right) \) algorithms for 3SUM and for the related problems Convolution3SUM and ZeroTriangle, where \(\alpha \) and \(\beta \) are constants that depend on the problem and whether the algorithm is deterministic or randomized (and for ZeroTriangle the main factor is \(n^3\) rather than \(n^2\)). We simplify Grønlund and Pettie’s algorithms and obtain better bounds, namely, \(\alpha =\beta =1\), deterministically. For 3SUM our bound is better than both the deterministic and the randomized bounds of Grønlund and Pettie. For the other problems our bounds are better than their deterministic bounds, and match their randomized bounds.

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.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3

Similar content being viewed by others

Notes

  1. Although randomized algorithms are often significantly simpler than their deterministic counterparts, this is not the case here. Grønlund and Pettie’s randomized algorithms are in fact more complicated than our (and their) deterministic ones, and thus offer no advantage.

  2. Throughout this paper we follow the convention that array indexing starts at 1 (as opposed to 0, which is the convention followed by a number of popular programming languages).

  3. Cautionary remark to readers familiar with Grønlund and Pettie [8]: they use the standard matrix indexing scheme, in which square (ij) is in the ith row from the top and the jth column from the left. Also, they associate A with the vertical axis and B with the horizontal one.

  4. Note that the vector components are actual numbers that we can compute, since we now have A and B.

  5. For additional recent results on restricted ranges of d see Impagliazzo et al. [9, Sec. 3] and Chan [5, Appx. A].

References

  1. Ailon, N., Chazelle, B.: Lower bounds for linear degeneracy testing. J. ACM 52(2), 157–171 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  2. Baran, I., Demaine, E.D., Pǎtraşcu, M.: Subquadratic algorithms for 3SUM. Algorithmica 50(4), 584–596 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  3. Butman, A., Clifford, P., Clifford, R., Jalsenius, M., Lewenstein, N., Porat, B., Porat, E., Sach, B.: Pattern matching under polynomial transformation. SIAM J. Comput. 42(2), 611–633 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  4. Chan, T.M.: All-pairs shortest paths with real weights in \(\text{ O }(n^3/\log n)\) time. Algorithmica 50(2), 236–243 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  5. Chan, T.M.: Speeding up the four Russians algorithm by about one more logarithmic factor. In: Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 212–217. Society for Industrial and Applied Mathematics, Philadelphia (2015)

  6. Erickson, J.: Lower bounds for linear satisfiability problems. Chic. J. Theor. Comput. Sci. 8, 388–395 (1997)

    MATH  Google Scholar 

  7. Gajentaan, A., Overmars, M.H.: On a class of \(\text{ O }(n^2)\) problems in computational geometry. Comput. Geom. 5(3), 165–185 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  8. Grønlund, A., Pettie, S.: Threesomes, degenerates, and love triangles. In: Proceedings of the 55th IEEE Symposium on Foundations of Computer Science. ArXiv preprint arXiv:1404.0799 (2014)

  9. Impagliazzo, R., Lovett, S., Paturi, R., Schneider, S.: 0–1 Integer linear programming with a linear number of constraints. ArXiv preprint arXiv:1401.5512 (2014)

  10. Pǎtraşcu, M.: Towards polynomial lower bounds for dynamic problems. In: Proceedings of the Forty-Second ACM Symposium on Theory of Computing, pp. 603–610. Association for Computing Machinery, New York (2010)

  11. Preparata, F.P., Shamos, M.I.: Computational Geometry, an Introduction. Springer, New York (1985)

    Book  MATH  Google Scholar 

Download references

Acknowledgments

The author is grateful to the anonymous reviewers (especially “Reviewer #1”) for helpful suggestions on improving the presentation.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ari Freund.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Freund, A. Improved Subquadratic 3SUM. Algorithmica 77, 440–458 (2017). https://doi.org/10.1007/s00453-015-0079-6

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00453-015-0079-6

Keywords

Navigation