Dynamic Programming Flashcards
1
Q
What is memoization?
A
Memoization is a specific form of caching that involves caching the return value of a function based on its parameters.
2
Q
What are the two components of dynamic programming?
A
Solving a problem using divide and conquer (recursion) and memoization (caching results)
3
Q
How do you identify if a problem can be optimized with dynamic programming?
A
- Can it be divided into subproblems?
- Are the subproblems repetitive?
If so then, dynamic programming is perfect
4
Q
What is the trade off when using memoization?
A
You now have to hold a cache of values which increases space complexity