Is the Sieve of Eratosthenes an example of Dynamic Programming?
问题 I'm a bit confused as to whether the Sieve of Eratosthenes (implemented with an array for all the numbers and a loop marking the composite numbers) is an example of Dynamic Programming? A couple of friends were telling me the way it's implemented is an example of Bottom Up DP, but I'm having trouble seeing it. Exactly what are the subproblems and how would you implement SoE with Top-Down / Recursion? Thanks guys. 回答1: Sure, we could think of the Sieve of Eratosthenes as an example of dynamic