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.

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

What are the two components of dynamic programming?

A

Solving a problem using divide and conquer (recursion) and memoization (caching results)

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

How do you identify if a problem can be optimized with dynamic programming?

A
  1. Can it be divided into subproblems?
  2. Are the subproblems repetitive?

If so then, dynamic programming is perfect

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

What is the trade off when using memoization?

A

You now have to hold a cache of values which increases space complexity

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