Takeaways
- Dynamic Programming is an algorithm technique used for optimization problems that involves smartly using recursion to solve a problem with many overlapping subproblems
- All DP problems require optimal substructure, and overlapping subproblems
- In top-bottom DP, we remember answers of previously-solved subproblems with a memoization table
- In bottom-up DP, we calculate all subproblems with a tabulation table filled with a loop
- Dynamic programming is a great way to get a non-polynomial (recusrive) algorithm to polynomial time
Code
CoinFinderDP is a dynamic programming algorithm that will find the minimum number of way to make P cents. It includes a bottom-up and top-down implementation.
EditDistanceDP is a dynamic programming algorithm that will compute the edit distance between two strings. You will need to use that code for program 4.