|
|
|
|
|
by NoThisIsMe
337 days ago
|
|
You're thinking of memoization, which is related to but distinct from DP. Memoization is "top down", DP is "bottom up". DP generally has better space complexity (memory requirements). For example, for a function that computers the Fibonacci sequence, space complexity with memoization is O(n), vs O(1) with DP. https://en.wikipedia.org/wiki/Dynamic_programming#Fibonacci_... |
|
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.