Question discussion

A 0/1 knapsack has capacity 5 and four items with weights 2, 3, 4, 5 and values 3, 4, 5, 6. What is the maximum total value?

1143Medium DSSSB TGT Computer Science 0 replies 1 views
0

A 0/1 knapsack has capacity 5 and four items with weights 2, 3, 4, 5 and values 3, 4, 5, 6. What is the maximum total value?

  • A6
  • B7
  • C8
  • D9
Correct answer: B

Explanation

Items 1 and 2 (weights 2 + 3 = 5) give 3 + 4 = 7, which beats any single item (best 6).

Discussion 0

Nobody has replied yet. Start the discussion!