Dynamic Programming, greedy algorithms Flashcards
1
Q
What is the gist of memoization?
A
Solve a subproblem
store the answer
if we come to this subproblem again use the answer in the dictionary
2
Q
What is the runtime of computing nth Fibonacci when using dynamic programming?
A
O(n)
3
Q
What steps should you go through when solving a dynamic programming problem?
A
- define subproblems
- guess (part of solution) - possible solutions to check
- relate sub problem solutions - what is the recurrence relation
- recurse and memoize or build a DP table bottom up
- solve the original problem