Solve problems with dynamic programming
8 steps · about 4 h 45 min · Intermediate
- Review the dynamic-programming model (guide, MIT OpenCourseWare, 40 min)
Connect subproblems, guesses, recurrence and evaluation order in one reusable framework.
- Start with memoization (guide, CP-Algorithms, 35 min)
Cache recursive subproblem results and observe how repeated work disappears.
- Translate to bottom-up evaluation (guide, Wikipedia, 30 min)
Order states so every dependency is ready before it is used.
- Trace a shortest-path recurrence (guide, Princeton Algorithms, 35 min)
See how optimal substructure can turn a global choice into linked local states.
- Model a sequence problem (guide, CP-Algorithms, 40 min)
Define what each state means before choosing transitions for a longest increasing subsequence.
- Control state updates in knapsack (guide, CP-Algorithms, 40 min)
Understand why iteration direction distinguishes using an item once from using it repeatedly.
- Implement a cached recurrence (reference, Python documentation, 25 min)
Use a standard unbounded cache while keeping the recursive state explicit and testable.
- Evaluate state and transition costs (guide, CP-Algorithms, 40 min)
Count reachable states, work per transition and stored values before claiming an improvement.