Question

2. Here is another variation of the knapsack problem. We are given n items of sizes

a1, a2,..., an, which are positive integers. Further, for each 1 ≤ i ≤n, the i-th item a; has

a positive value value(a;) (you may consider value(a;) as the amount of dollars the item is

worth). The knapsack size is a positive integer M.

Question image 1