Welcome to the step-by-step visualization of the DP table for the 0/1 Knapsack problem.
We'll fill a table where dp[i][w] represents the maximum value we can achieve with items 0 to i and weight capacity w.
Click 'Next' to start the animation.
Weight (w) → Item (i) ↓ |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|---|---|
0 (no items) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 (w=1, v=1) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2 (w=4, v=4) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3 (w=5, v=7) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4 (w=7, v=9) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |