Repository navigation
Description
Describe the Issue
The Dynamic Programming Review omits concepts taught in What Is Dynamic Programming and What Are Some Common Algorithms?.
-
The stair-counting examples lack a problem statement. The solutions section begins with:
Line 18 in 3d52c81
- **Memoization (Top-Down Approach)**: Memoization stores the results of expensive function calls and returns the cached result when the same inputs occur again. The memoization and tabulation examples both count ways to climb stairs, but the review never explains what
nrepresents or that each move can climb one or two steps. Without that setup, the reason for adding the counts forn - 1andn - 2is missing. -
The time and space complexity comparison is missing. The introduction describes avoiding repeated work:
Line 13 in 3d52c81
- **Overlapping Subproblems**: The same smaller problems appear multiple times when solving the larger problem. Instead of recalculating these subproblems repeatedly, we store their solutions. However, the review does not compare the exponential naive recursive approach with the linear-time memoization and tabulation examples. It also omits their storage costs and the distinction between memoization's recursive call stack and iterative tabulation.
-
The constant-space tabulation optimization is missing. The tabulation explanation says:
Line 36 in 3d52c81
- **Tabulation (Bottom-Up Approach)**: Tabulation builds the solution from the ground up, filling a table with solutions to subproblems. The example stores all intermediate counts in a list. The lesson also teaches that each new count depends only on the previous two values, allowing the full table to be replaced with a fixed number of variables. The review does not cover this optimization.
-
The minimum-coin algorithm is missing. The applications section includes:
Line 62 in 3d52c81
- **Resource Allocation**: The knapsack problem and its variants appear in scheduling, budgeting, and resource management. It lists applications but does not summarize the lesson's worked coin change algorithm. This leaves out the minimum-coin recurrence, initialization, unreachable-amount handling, and complexity. For example, the lesson uses denominations
[1, 3, 4]and a target of6, where the minimum is two coins (3 + 3).
Affected Pages
Expected behavior
-
The review should introduce the staircase problem before its solutions: for a positive number of steps
n, count the distinct ways to reach the top when each move climbs one or two steps. -
The review should compare the
O(2^n)time upper bound for naive stair-counting recursion withO(n)time for memoization with an initially empty cache and for tabulation. It should explain theO(n)space used by the memo dictionary and recursive call stack, or by the tabulation list, and that iterative tabulation avoids recursive stack growth. -
The review should explain and briefly demonstrate retaining only the previous two stair counts. It should summarize the lesson's
O(n)time andO(1)auxiliary-space analysis for this optimization. -
The review should summarize the minimum-coin algorithm with a concise example. It should explain the zero-amount base case, infinity for initially unreachable amounts, minimizing
dp[i - coin] + 1over eligible denominations, and returning-1when the target remains unreachable. It should include the taughtO(amount * number_of_coins)time andO(amount)space complexity.
Activity