what is dynamic programming
Dynamic Programming is an algorithm design technique
for optimization problems
– Often minimizing or maximizing an answer
- Reusing computation
Contrast the Divide and Conquer and Dynamic Programming
approaches to solving problems
Like Divide & Conquer, DP solves problems by combining
solutions to subproblems, they are recursive
Unlike Divide & Conquer, subproblems are not independent. Overlapping or repeated subproblems, DP has optimization, DP has storage
D&C solves independent subproblems recursively, while DP solves overlapping subproblems and stores their solutions
Identify when Dynamic Programming should be used to solve a problem
Properties of a problem that can be solved
with DP
Define the Principle of Optimality
what is the difference between memoization and tabulation in DP?
memoization uses a top down approach, while tabulation uses a bottom up approach
what does matrix chain multiplication solve
given n matrices, what is the least expensive order to multiply them in
what does the knapsack problem solve
how to maximize the total value of items while the total weight remains below the limit
what does longest common subsequence problem solve
To find one of the longest common subsequences of a pair of sequences
what does optimal binary search trees solve
Want to build a binary search tree (BST) with
minimum expected search cost.
Expected search cost is based on probability that we are searching for a given value, and its height.