Math · Intermediate · Lesson 6 of 7
The Knapsack Problem
Whole items only
An interactive lesson with 6 steps, about 5 minutes: you predict, drag and solve, with instant feedback on every answer. It runs in your browser and needs JavaScript.
What you’ll learn
- In the knapsack problem, items are all-or-nothing.
- Greedy (best value per kilogram first) is fast but can miss the optimum.
- Exact knapsack is NP-hard in general, though practical methods work well.
Steps
- Take it or leave it
- Pack the rucksack
- The greedy trap
- Checking everything
- Cutting the cheese
- How hard?