Efficient reductions and algorithms for variants of Subset Sum
Given (a_1, …, a_n, t) ∈ℤ_≥ 0^n + 1, the Subset Sum problem (𝖲𝖲𝖴𝖬) is to decide whether there exists S ⊆ [n] such that ∑_i ∈ S a_i = t. There is a close variant of the 𝖲𝖲𝖴𝖬, called 𝖲𝗎𝖻𝗌𝖾𝗍 𝖯𝗋𝗈𝖽𝗎𝖼𝗍. Given positive integers a_1, ..., a_n and a target integer t, the 𝖲𝗎𝖻𝗌𝖾𝗍 𝖯𝗋𝗈𝖽𝗎𝖼𝗍 problem asks to determine whether there exists a subset S ⊆ [n] such that ∏_i ∈ S a_i=t. There is a pseudopolynomial time dynamic programming algorithm, due to Bellman (1957) which solves the 𝖲𝖲𝖴𝖬 and 𝖲𝗎𝖻𝗌𝖾𝗍 𝖯𝗋𝗈𝖽𝗎𝖼𝗍 in O(nt) time and O(t) space. In the first part, we present search algorithms for variants of the Subset Sum problem. Our algorithms are parameterized by k, which is a given upper bound on the number of realisable sets (i.e., number of solutions, summing exactly t). We show that 𝖲𝖲𝖴𝖬 with a unique solution is already NP-hard, under randomized reduction. This makes the regime of parametrized algorithms, in terms of k, very interesting. Subsequently, we present an Õ(k· (n+t)) time deterministic algorithm, which finds the hamming weight of all the realisable sets for a subset sum instance. We also give a poly(knt)-time and O(log(knt))-space deterministic algorithm that finds all the realisable sets for a subset sum instance. In the latter part, we present a simple and elegant randomized Õ(n + t) time algorithm for 𝖲𝗎𝖻𝗌𝖾𝗍 𝖯𝗋𝗈𝖽𝗎𝖼𝗍. Moreover, we also present a poly(nt) time and O(log^2 (nt)) space deterministic algorithm for the same. We study these problems in the unbounded setting as well. Our algorithms use multivariate FFT, power series and number-theoretic techniques, introduced by Jin and Wu (SOSA'19) and Kane (2010).
READ FULL TEXT