Subset Sum

Given positive integers a1,…,ana_1,\ldots,a_n and a nonnegative target tt, decide whether a subset sums to tt; repeats and the empty subset are allowed. For n≥2n\ge2, let bb be the maximum input or target bit length. A single randomized word-RAM program uses w=⌈4(n+b+log⁡2(n+2))⌉w=\lceil4(n+b+\log_2(n+2))\rceil-bit words, halts on every run and is correct with probability at least 2/32/3 on each input.

Classic bound: O∗(2n/2)O^*(2^{n/2}) (Horowitz and Sahni 1974).

Full computation rules

Word reads and writes, indirect addressing, comparison, arithmetic (including multiplication, division and remainder), bitwise operations, shifts and independent uniform random words each cost one operation. Overflow costs multiple operations. Retained random words use memory. All input access and preparation count; the program has no advice or external tables. For each fixed cc and b≤ncb\le n^c, the bound holds for every random outcome, and the program does not depend on cc.

The bound has the form O(2αn)O(2^{\alpha n}). α\alpha is the time exponent; lower is better.

RankBoundEvidence levelLevelPlayerDateLink
1O(20.49n)O(2^{0.49n})First breakthroughopenaiSourceopenai

α\alpha in O(2αn)O(2^{\alpha n}), lower is betterα\alpha in O(2αn)O(2^{\alpha n})linear scale, lower is better

ClaimedHuman VerifiedLean Verified
First breakthrough
α\alpha (linear scale)
α=0: O(1)\alpha=0:\ O(1)

Relevant repos