7 Step Process
Dynamic Programming
- DP = recursion +memoization
- MINIMUM NUMBER OF OPERATIONS
- MAXIMUM NUMBER OF SOMETHING
- DEPTH FIRST SEARCH CAN BE IMPLEMENTED WITH THIS
- NUMBER OF DIFFERENT WAYS TO SOLVE SOMETHING
- Identify the base cases for the larger problem, the smallest possible subproblem you can encounter
- ALSO STATE SOME POTENTIAL EDGE CASES—USE FOR VERIFICATION AFTER FIRST PASS AT CODE
- Come up with a generic example and then state and talk through the brute force algorithm
- Break it down into subproblems and then see how you have to change pointers, what to pass to subsequent calls
- Start writing pseudocode as you talk through this
- State that because its a recursive solution using dynamic programming(memoization) would optimize this
- Try to determine whether its bottom up or top down DP
- BOTTOMS UP
- You are computing the smallest possible subproblems and then comparing or combining them as you move back up the recursive stack to the largest subproblem
- Determine how the cache or data structure used for memoization is going to store it- verify the runtime here
- start debugging- verify with edge cases and examples
Recursion