Assignment on Knapsack Using Greedy
Assignment on
Knapsack Problem Using Greedy Method.
1. A thief enters a house for robbing it. He can
carry a maximal weight of 70 kg into his bag. There are 5 items in the house
with the following weights and values. What items should thief take if he can
even take the fraction of any item with him?
Item
|
Weight
|
Value
|
1
|
5
|
30
|
2
|
10
|
40
|
3
|
20
|
45
|
4
|
22
|
77
|
5
|
30
|
90
|
2. Knapsack
Capacity W = 30
Item
|
A
|
B
|
C
|
D
|
Value
|
50
|
140
|
60
|
60
|
Size
|
5
|
20
|
10
|
12
|
3.
Solve the Greedy Knapsack Problem Where
m=10,n=4,P=(40,42,25,12), W=(4,7,5,3)
4.
Solve the Greedy Knapsack Problem where Capacity W=5
Item
|
Value
|
Cost
|
1
|
2
|
12
|
2
|
1
|
10
|
3
|
3
|
20
|
4
|
2
|
15
|
5 5. Apply Greedy method to obtain a optimal solution
to knapsack problem given M=60,
(w1,w2,w3,w4,w5)=(5,10,20,30,40) ,
(p1,p2,p3,p4,p5)=(30,20,100,,90,160).Find the total profit earned.
Submit Solutions Here👆
Comments
Post a Comment