Dynamic Programming21 sections · 916 units
Open in Course

Why It Works

Convexity requirement

The Aliens Trick requires convexity (a shape that curves in one direction, like the bottom of a bowl). Let g(k)g(k) = minimum cost using exactly kk segments. The function gg must be convex, meaning: the marginal benefit of adding one more segment decreases as kk grows. Mathematically: g(k1)g(k)g(k)g(k+1)g(k-1) - g(k) \geq g(k) - g(k+1).

Each additional segment helps less than the previous one. Most partitioning problems satisfy this naturally. If yours doesn't, the trick fails. Always verify convexity before applying.