We reexamine the classical subset sum problem: given a set $X$ of $n$ positive integers and a number $t$, decide whether there exists a subset of $X$ that sums to $t$; or more generally, compute the set $\mbox{out}$ of all numbers $y\in\{0,\ldots,t\}$ for which there exists a subset of $X$ that sums to $y$. Standard dynamic programming solves the problem in $O(tn)$ time. In SODA'17, two papers appeared giving the current best deterministic and randomized algorithms, ignoring polylogarithmic factors: Koiliaris and Xu's deterministic algorithm runs in $\widetilde{O}(t\sqrt{n})$ time, while Bringmann's randomized algorithm runs in $\widetilde{O}(t)$ time. We present the first deterministic algorithm running in $\widetilde{O}(t)$ time. Our technique has a number of other applications: for example, we can also derandomize the more recent output-sensitive algorithms by Bringmann and Nakos [STOC'20] and Bringmann, Fischer, and Nakos [SODA'25] running in $\widetilde{O}(|\mbox{out}|^{4/3})$ and $\widetilde{O}(|\mbox{out}|\sqrt{n})$ time, and we can derandomize a previous fine-grained reduction from 0-1 knapsack to min-plus convolution by Cygan et al. [ICALP'17].
翻译:我们重新审视经典的子集和问题:给定一个包含 $n$ 个正整数的集合 $X$ 和一个目标值 $t$,判断是否存在 $X$ 的一个子集,其元素之和等于 $t$;或者更一般地,计算集合 $\mbox{out}$,其中包含所有满足条件的 $y\in\{0,\ldots,t\}$,使得存在 $X$ 的一个子集,其元素之和等于 $y$。标准的动态规划方法可以在 $O(tn)$ 时间内解决该问题。在 SODA'17 会议上,两篇论文提出了当前最优的确定性和随机化算法(忽略多对数因子):Koiliaris 和 Xu 的确定性算法运行时间为 $\widetilde{O}(t\sqrt{n})$,而 Bringmann 的随机化算法运行时间为 $\widetilde{O}(t)$。我们提出了首个运行时间为 $\widetilde{O}(t)$ 的确定性算法。我们的技术还具有若干其他应用:例如,我们还可以对 Bringmann 和 Nakos [STOC'20] 以及 Bringmann、Fischer 和 Nakos [SODA'25] 提出的、运行时间分别为 $\widetilde{O}(|\mbox{out}|^{4/3})$ 和 $\widetilde{O}(|\mbox{out}|\sqrt{n})$ 的近期输出敏感算法进行去随机化,并且可以对 Cygan 等人 [ICALP'17] 提出的从 0-1 背包问题到最小加卷积的先前细粒度规约进行去随机化。