Concept Flow - 0 1 Knapsack Problem
Start with empty knapsack
For each item i
For each weight w from 0 to max capacity
Check if item i fits in weight w
Include item i: value = value[i
Exclude item i: value = dp[i-1
Choose max of include/exclude
Update dp table
Repeat for all items and weights
Final answer at dp[last_item
The flow shows how we build a table step-by-step, deciding for each item and weight whether to include the item or not, and storing the best value.
