AlgoViz

0/1 knapsack

medium 22 min

Pack items with weights and values into a bag of capacity W to get the most value, each item taken whole or not at all.

Check yourself

One question at a time. Each answer explains why.

Question 1 of 10

Score 0
conceptual

What does "0/1" mean in 0/1 knapsack?

Pick an answer to see why.

Flashcards

Say your answer, then reveal it.

Card 1 of 12

Recall

What does dp[i][w] mean in 0/1 knapsack?

Say your answer, then reveal it.

These cards come back in Today, just before you would forget them.