1.

You are given a knapsack that can carry a maximum weight of 60. There are 4 items with weights {20, 30, 40, 70} and values {70, 80, 90, 200}. What is the maximum value of the items you can carry using the knapsack?(a) 160(b) 200(c) 170(d) 90This question was posed to me in an international level competition.Query is from 0/1 Knapsack Problem topic in division Dynamic Programming of Data Structures & Algorithms II

Answer» RIGHT answer is (a) 160

Explanation: The maximum VALUE you can get is 160. This can be achieved by CHOOSING the items 1 and 3 that have a total weight of 60.


Discussion

No Comment Found

Related InterviewSolutions