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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the runtime of computing nth Fibonacci when using dynamic programming?

A

O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What steps should you go through when solving a dynamic programming problem?

A
  1. define subproblems
  2. guess (part of solution) - possible solutions to check
  3. relate sub problem solutions - what is the recurrence relation
  4. recurse and memoize or build a DP table bottom up
  5. solve the original problem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly