GATE Computer ScienceModerateGATE CS

A 0/1 knapsack has capacity 50 and items given as (value, weight): (60, 10), (100, 20), (120, 30), (75, 25). The maximum total value is:

  1. A. 220
  2. B. 240
  3. C. 160
  4. D. 175

Correct answer: A. 220

The best choice is the items (100, 20) and (120, 30), with weight 50 and value 220. 240 is the fractional-knapsack optimum, and 160 is what the greedy-by-ratio rule gets for the 0/1 version.

More Algorithms questions

Exams that ask this topic