# Faster pseudo-polynomial time algorithm for subset-sum?

Let $S(X) = \{\sum_{i\in Y} i | Y\subset X \}$, the set of subset sums of $X$. $S_n(X) = S(X)\cap \{1,\ldots,n\}$. Consider the following variant of subset sum.

ALL-SUBSET-SUMS
INPUT: positive integer $n$ and set $X\subset \{1,\ldots,n\}$.
OUTPUT: $S_n(X)$

There is the common dynamic programming algorithm taught in algorithm classes, which takes $O(n |X|)$ time. It takes $O(n^2)$ time for large input sets. It's not hard to devise and output sensitive version that takes $O(|X||S_n(X)|+n)$ time.

It's possible to solve it in $O((n \log n)^\frac{3}{2})$ time by decompose the problem to $\sqrt{n\log n}$ ALL-SUBSET-SUMS with small output size, and we can combine the solutions through FFT.

How fast can we solve this problem? There are subset sum algorithms using analytical number theory, but they have many technical conditions on the input. It can't be applied directly on ALL-SUBSET-SUMS.

Reference:

 M. Chaimovich , G. Freiman , Z. Galil, Solving dense subset-sum problems by using analytical number theory, Journal of Complexity, v.5 n.3, p.271-282, Sept. 1989

• Why pseudo-polynomial? – Saeed Mar 14 '14 at 10:04
• Because there is no polynomial time algorithm for this problem. We can find $|X|=O(\log n)$ and $|S_n(X)| = \Omega(n)$. The output alone takes exponential time with respect to the input size. – Chao Xu Mar 14 '14 at 19:53
• I see, I thought may be |X| is in $\Omega(n)$. – Saeed Mar 14 '14 at 22:54