Project: Portfolio Selection · Tracking Dynamic Programming
Lesson 4
This limitation is not an accident of our recurrence. Even the much simpler question “can some subset of numbers have total sum exactly \(T\)?” is the subset sum problem. Its generating function is \[\prod_{i}(1+z^{s_i}),\] and the question asks whether the coefficient of \(z^{T}\) is nonzero. This is the same kind of object that appears in our portfolio polynomial.
The dynamic-programming table is the pseudo-polynomial side. For a target \(T\), the textbook bound is \(O(nT)\), and it was eventually improved all the way to a randomized, essentially linear \(\widetilde{O}(n+T)\) algorithm (Bringmann, 2017). This is essentially optimal: under the Strong Exponential Time Hypothesis, no algorithm runs in time \(T^{1-\varepsilon}\ 2^{o(n)}\). Meet in the middle is the exponential side. Its \(O^{*}(2^{n/2})\) running time goes back to Horowitz and Sahni in 1974, and, remarkably, no one knows how to do substantially better in the worst case: whether subset sum admits an \(O^{*}\!\left(2^{(1/2-\varepsilon)n}\right)\) algorithm is a long-standing open problem.For the curious 🤓