Dynamic Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is dynamic programming?

A

Dynamic programming solves problems by combining the solutions to subproblems

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

What is the difference between DP and divide-and-conquer?

A

D&C algorithms partition the problem into disjoint subproblems, solve the subproblems recursively, and then combine their solutions to solve the original problem.
In contrast, DP applies when the subproblems overlap - that is, when subproblems share subsubproblems.

In this context, a D&C algorithm does more work than necessary, repeatedly solving the common subsubproblems.

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

What are the steps do develop a DP algorithm?

A
  1. Characterize the structure of an optimal solution.
  2. Recursively define the value of an optimal solution
  3. Compute the value of an optimal solution, typically in a bottom-up fashion.
  4. Construct an optimal solution from computed information
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are key characteristics a optimization problem must have in order for DP to apply?

A
  1. Optimal substructure

2. Overlapping subproblems

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

What does ‘optimal substructure’ mean in the context of DP?

A

A problem exhibits optimal substructure if an optimal solution to the problem contains within it optimal solutions to subproblems.

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

What does ‘overlapping subproblems’ mean in the context of DP?

A

When a recursive algorithm revisits the same problem repeatedly, we say that the optimization problem has overlapping subproblems. DP algorithms typically take advantage of overlapping subproblems by solving each subproblem once and then storing the solution in a table where it can be looked up when needed, using constant time per lookup.

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