Solve problems with dynamic programming

8 steps · about 4 h 45 min · Intermediate

  1. Review the dynamic-programming model (guide, MIT OpenCourseWare, 40 min)

    Connect subproblems, guesses, recurrence and evaluation order in one reusable framework.

  2. Start with memoization (guide, CP-Algorithms, 35 min)

    Cache recursive subproblem results and observe how repeated work disappears.

  3. Translate to bottom-up evaluation (guide, Wikipedia, 30 min)

    Order states so every dependency is ready before it is used.

  4. Trace a shortest-path recurrence (guide, Princeton Algorithms, 35 min)

    See how optimal substructure can turn a global choice into linked local states.

  5. Model a sequence problem (guide, CP-Algorithms, 40 min)

    Define what each state means before choosing transitions for a longest increasing subsequence.

  6. Control state updates in knapsack (guide, CP-Algorithms, 40 min)

    Understand why iteration direction distinguishes using an item once from using it repeatedly.

  7. Implement a cached recurrence (reference, Python documentation, 25 min)

    Use a standard unbounded cache while keeping the recursive state explicit and testable.

  8. Evaluate state and transition costs (guide, CP-Algorithms, 40 min)

    Count reachable states, work per transition and stored values before claiming an improvement.