Dynamic Programming

The DP solution iterates through the states in some particular order set by coder, while memoization iterates through them in order of depth-first search

Running time

The running time depends on the product of two factors: the number of subproblems overall and how many choices we look at for each subproblem.

Assembly Line Scheduling: O(n) subproblems, and 2 choices => O(n) Matrix Chain Multiplication: O(n^2) subproblems, O(n) choices => O(n^3)

Why use Bottom Up DP?

Pro:

Why use memoization?

Pros

Cons

Running time:

Consider drawing the subproblem graph for bottom up solution. Count the number of subproblems using parameters space. Find out running time of each. See if any parameters have stricter bounds. Use substitution (guessing) method to solve recurrence.

References:


28 May 2018