2 ms·
Both top down and bottom up approaches can be used with dynamic programming. DP is about how you approach solving a problem by breaking it into subproblems (see
by Jtsummers 1y ago
Both top down and bottom up approaches can be used with dynamic programming. DP is about how you approach solving a problem by breaking it into subproblems (see the term used, "optimal substructure"). Whether you use that information for a top-down (often memoized) solution or a bottom-up solution is a choice for the implementor (and which depends on how you're using your solver and solutions).
If you need to solve one problem, bottom-up is often most efficient. But if you need to solve many related problems (say trialing many different initial conditions) then you may want the memoized solution.