What information entered the process?
Labs / Computer Science
Knapsack Packer
You have a bag with a weight limit and a pile of items, each worth some money. Which items should you take to walk away with the most value? Watch the dynamic-programming table fill in one cell at a time, then light up the winning subset by tracing back through its own decisions. Drag any item card to change its weight & value and the whole solution re-solves.
Labs / Computer Science / Knapsack Packer
Knapsack Packer
You have a bag with a weight limit and a pile of items, each worth some money. Which items should you take to walk away with the most value? Watch the dynamic-programming table fill in one cell at a time, then light up the winning subset by tracing back through its own decisions. Drag any item card to change its weight & value and the whole solution re-solves.
Why it matters
Why explore this?
Computer science turns clear rules into reliable processes. This model lets you step through those rules and see how each decision changes the result.
Explore
Try the model
Investigate
Questions to test
Predict first, try it in the model, then use what you observe to answer.
What to try
- Each new cell only looks at two older cells. Can you spot which two the amber outlines point to, and why those?
- Turn on the greedy solver. When does grabbing the best value-per-kg item first actually miss the true optimum?
- Drag an item to make it heavier without changing its value. At what weight does it drop out of the chosen set?
- Shrink the capacity one kilogram at a time. Does the best value fall smoothly, or does it jump?
- Add a fifth or sixth item — how many more cells does the table need before it finishes?
Explain
Make sense of what happened
Trace the process one step at a time. Name the rule used at each important step, then explain why the final result follows from those rules.
Check
Before you leave
Which rule changed it?
Why did the process produce this result?
If you can answer all three using evidence from the model, you understand the main idea. If not, return to Explore and change one setting at a time.