Document Open Access Logo

Subset Sum in Time 2^{n/2} / poly(n)

Authors Xi Chen , Yaonan Jin , Tim Randolph , Rocco A. Servedio

Thumbnail PDF


  • Filesize: 0.95 MB
  • 18 pages

Document Identifiers

Author Details

Xi Chen
  • Columbia University, New York, NY, USA
Yaonan Jin
  • Columbia University, New York, NY, USA
Tim Randolph
  • Columbia University, New York, NY, USA
Rocco A. Servedio
  • Columbia University, New York, NY, USA


We would like to thank Martin Dietzfelbinger for pointing out the work [Dietzfelbinger et al., 1997], as well as several anonymous referees for helpful suggestions.

Cite AsGet BibTex

Xi Chen, Yaonan Jin, Tim Randolph, and Rocco A. Servedio. Subset Sum in Time 2^{n/2} / poly(n). In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 275, pp. 39:1-39:18, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2023)


A major goal in the area of exact exponential algorithms is to give an algorithm for the (worst-case) n-input Subset Sum problem that runs in time 2^{(1/2 - c)n} for some constant c > 0. In this paper we give a Subset Sum algorithm with worst-case running time O(2^{n/2} ⋅ n^{-γ}) for a constant γ > 0.5023 in standard word RAM or circuit RAM models. To the best of our knowledge, this is the first improvement on the classical "meet-in-the-middle" algorithm for worst-case Subset Sum, due to Horowitz and Sahni, which can be implemented in time O(2^{n/2}) in these memory models [Horowitz and Sahni, 1974]. Our algorithm combines a number of different techniques, including the "representation method" introduced by Howgrave-Graham and Joux [Howgrave-Graham and Joux, 2010] and subsequent adaptations of the method in Austrin, Kaski, Koivisto, and Nederlof [Austrin et al., 2016], and Nederlof and Węgrzycki [Jesper Nederlof and Karol Wegrzycki, 2021], and "bit-packing" techniques used in the work of Baran, Demaine, and Pǎtraşcu [Baran et al., 2005] on subquadratic algorithms for 3SUM.

Subject Classification

ACM Subject Classification
  • Theory of computation → Design and analysis of algorithms
  • Exact algorithms
  • subset sum
  • log shaving


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Amir Abboud and Karl Bringmann. Tighter Connections Between Formula-SAT and Shaving Logs. In 45th International Colloquium on Automata, Languages, and Programming, ICALP 2018, July 9-13, 2018, Prague, Czech Republic, volume 107 of LIPIcs, pages 8:1-8:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018. Google Scholar
  2. Amir Abboud, Karl Bringmann, Danny Hermelin, and Dvir Shabtay. Seth-based lower bounds for subset sum and bicriteria path. ACM Transactions on Algorithms (TALG), 18(1):1-22, 2022. Google Scholar
  3. Per Austrin, Petteri Kaski, Mikko Koivisto, and Jesper Nederlof. Subset sum in the absence of concentration. In 32nd International Symposium on Theoretical Aspects of Computer Science (STACS 2015). Schloss Dagstuhl-Leibniz-Zentrum für Informatik, 2015. Google Scholar
  4. Per Austrin, Mikko Koivisto, Petteri Kaski, and Jesper Nederlof. Dense subset sum may be the hardest. 33rd Symposium on Theoretical Aspects of Computer Science (STACS 2016), pages 13:1-13:14, 2016. Google Scholar
  5. Ilya Baran, Erik D Demaine, and Mihai Patraşcu. Subquadratic algorithms for 3SUM. In Workshop on Algorithms and Data Structures, pages 409-421. Springer, 2005. Google Scholar
  6. Anja Becker, Jean-Sébastien Coron, and Antoine Joux. Improved generic algorithms for hard knapsacks. In Annual International Conference on the Theory and Applications of Cryptographic Techniques, pages 364-385. Springer, 2011. Google Scholar
  7. Richard Bellman. Dynamic programming. Science, 153(3731):34-37, 1966. Google Scholar
  8. Timothy Chan. The art of shaving logs. Presentation at WADS 2013, slides available at, 2013.
  9. Timothy M. Chan. The art of shaving logs. In Frank Dehne, Roberto Solis-Oba, and Jörg-Rüdiger Sack, editors, Algorithms and Data Structures - 13th International Symposium, WADS 2013, London, ON, Canada, August 12-14, 2013. Proceedings, volume 8037 of Lecture Notes in Computer Science, page 231. Springer, 2013. Google Scholar
  10. Xi Chen, Yaonan Jin, Tim Randolph, and Rocco A Servedio. Average-case subset balancing problems. In Proceedings of the 2022 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 743-778. SIAM, 2022. Google Scholar
  11. Marek Cygan, Fedor Fomin, Bart M.P. Jansen, Lukasz Kowalik, Daniel Lokshtanov, Daniel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Open problems for fpt school. Available at, 2014.
  12. Martin Dietzfelbinger, Torben Hagerup, Jyrki Katajainen, and Martti Penttonen. A reliable randomized algorithm for the closest-pair problem. Journal of Algorithms, 25(1):19-51, 1997. Google Scholar
  13. Jörg Flum and Martin Grohe. Parameterized Complexity Theory. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2006. URL:
  14. Allan Grønlund and Seth Pettie. Threesomes, degenerates, and love triangles. J. ACM, 65(4):22:1-22:25, 2018. URL:
  15. Godfrey Harold Hardy, Edward Maitland Wright, et al. An introduction to the theory of numbers. Oxford university press, 1979. Google Scholar
  16. Ellis Horowitz and Sartaj Sahni. Computing partitions with applications to the knapsack problem. Journal of the ACM (JACM), 21(2):277-292, 1974. Google Scholar
  17. Nick Howgrave-Graham and Antoine Joux. New generic algorithms for hard knapsacks. In Annual International Conference on the Theory and Applications of Cryptographic Techniques, pages 235-256. Springer, 2010. Google Scholar
  18. Richard M. Karp. Reducibility among combinatorial problems. In Raymond E. Miller and James W. Thatcher, editors, Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York, USA, pages 85-103. Plenum Press, New York, 1972. Google Scholar
  19. Marcin Mucha, Jesper Nederlof, Jakub Pawlewicz, and Karol Wegrzycki. Equal-subset-sum faster than the meet-in-the-middle. In Michael A. Bender, Ola Svensson, and Grzegorz Herman, editors, 27th Annual European Symposium on Algorithms, ESA 2019, September 9-11, 2019, Munich/Garching, Germany, volume 144 of LIPIcs, pages 73:1-73:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. URL:
  20. Jesper Nederlof and Karol Wegrzycki. Improving Schroeppel and Shamir’s algorithm for subset sum via orthogonal vectors. In STOC '21: 53rd Annual ACM SIGACT Symposium on Theory of Computing, Virtual Event, Italy, June 21-25, 2021, pages 1670-1683. ACM, 2021. Google Scholar
  21. David Pisinger. Dynamic programming on the word RAM. Algorithmica, 35(2):128-145, 2003. Google Scholar
  22. Richard Schroeppel and Adi Shamir. A T = O(2^n/2), S = O(2^n/4) algorithm for certain NP-complete problems. SIAM journal on Computing, 10(3):456-464, 1981. Google Scholar
  23. Gerhard J Woeginger. Open problems around exact algorithms. Discrete Applied Mathematics, 156(3):397-405, 2008. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail