0/1 Knapsack — Filling the DP Table

dp[i][w] = max( skip dp[i-1][w] , take v[i] + dp[i-1][w - w[i]] ). Watch each cell choose take vs skip, then trace the reconstruction path back from dp[n][W].

step 0

Items

dp[i][w] = max(skip, take)
skip (cell above) take (up + left by w[i]) current cell reconstruction path
Press Step to start filling the table.

DP table dp[i][w]

Press Step to begin. We fill dp row by row; each cell takes the better of skipping the item (the cell directly above) or taking it (its value plus the cell up and to the left by the item's weight).
Self-contained visualization. 0/1 knapsack, counting/value semiring; entries are exact best values. The bottom-right cell dp[n][W] is the answer. The red path shows reconstruction: a cell whose value differs from the one above means the item was taken. See junior.md and professional.md for the take-or-skip recurrence and its optimal-substructure proof.