โ Algorithm Design learning pathAlgorithm Design ยท Module 4 of 10
Dynamic programming
Solve overlapping subproblems once and reuse results.
๐ Key ideas
- DP applies when subproblems overlap and optimal substructure exists.
- Memoisation: top-down recursion with caching.
- Tabulation: bottom-up table filling.
- Classic problems: Fibonacci, 0/1 knapsack, LCS, edit distance, coin change, matrix chain.
- Define state, transition and base cases.
๐ก Real-life example: DP is writing answers in a notebook so you never solve the same sum twice.
MemoisationCaching recursive results
TabulationBottom-up table
StateParameters describing a subproblem
TransitionHow states relate