0
2.9kviews
Write a program for knapsack problem

Consider the following instance of knapsack problem:

No. of objects n=3, knapsack capacity m=20 profit (p1,p2,p3)= (25, 24, 15) and weight (w1, w2,w3)=(18, 15, 10)

1 Answer
1
11views

Given,

weights = {18, 15, 10}

values = {25, 24, 15}

weight(w) = 20


Here, the weight of the knapsack is 20. So, we can only put any 1 item in the knapsack.

On putting, 1st item - value will be 25 and weight will be 18.

On putting, 1st …

Create a free account to keep reading this post.

and 2 others joined a min ago.

Please log in to add an answer.