English

A Near-Linear Pseudopolynomial Time Algorithm for Subset Sum

Data Structures and Algorithms 2017-01-10 v2

Abstract

Given a set ZZ of nn positive integers and a target value tt, the Subset Sum problem asks whether any subset of ZZ sums to tt. A textbook pseudopolynomial time algorithm by Bellman from 1957 solves Subset Sum in time O(nt)O(nt). This has been improved to O(nmaxZ)O(n \max Z) by Pisinger [J. Algorithms'99] and recently to O~(nt)\tilde O(\sqrt{n} t) by Koiliaris and Xu [SODA'17]. Here we present a simple randomized algorithm running in time O~(n+t)\tilde O(n+t). This improves upon a classic algorithm and is likely to be near-optimal, since it matches conditional lower bounds from Set Cover and k-Clique. We then use our new algorithm and additional tricks to improve the best known polynomial space solution from time O~(n3t)\tilde O(n^3 t) and space O~(n2)\tilde O(n^2) to time O~(nt)\tilde O(nt) and space O~(nlogt)\tilde O(n \log t), assuming the Extended Riemann Hypothesis. Unconditionally, we obtain time O~(nt1+ε)\tilde O(n t^{1+\varepsilon}) and space O~(ntε)\tilde O(n t^\varepsilon) for any constant ε>0\varepsilon > 0.

Keywords

Cite

@article{arxiv.1610.04712,
  title  = {A Near-Linear Pseudopolynomial Time Algorithm for Subset Sum},
  author = {Karl Bringmann},
  journal= {arXiv preprint arXiv:1610.04712},
  year   = {2017}
}

Comments

accepted at SODA'17, 18 pages

R2 v1 2026-06-22T16:21:46.607Z