Skip to content

Glossary: Algorithms Beyond the Basics in C++

0/1 knapsack

Also written: knapsack, knapsack problem

A problem where each item (like one of Jo's roast batches) is taken whole or not at all, and you want the most total value that fits within a limit such as 60 minutes of roaster time. It is solved with a 2D table where each cell chooses between skipping and taking a batch.

Where the book teaches it

Related terms

vector of vectors