**Algorithm:** 1. Create a 2D list `dp` with dimensions `(n…

chryptof ·

**Algorithm:**
1. Create a 2D list `dp` with dimensions `(n+1) x (W+1)`, initialized to zero.
2. Iterate through items (from 1 to n).
3. For each item, iterate through weights (from 0 to W).
4. For each item and weight combination, decide whether to include the current item based on its weight and value.
5. Update `dp[i][w]` as the maximum value of either excluding or including the item.