programmixg
10. Sulveoli Koaysack proklem uing dynamic
Rrefit
Me weiqht
capaucty
Total Cayacty , M=4
(w) weignt
21 4
Wi
3 3 3 3
wib 3 10
3 7
5 8
3 12
12 2
21/al24
Sslue i ol kaapsack prcblem Mcing(dymanic programning
t&, &, Pu,ee E, 2, 6,64
M nz A Compare Ni Weighty
Max Welqt)
&insert the pofit
Valesinside
box 2Ye SWefa ht=0 23
PrefitCP)
P Wi
22 2- 2 3 33
5 4 5 5 67 7
6 4 2 5 667 previous fow
2-6-2
in
but2 glso
Sonot
i
So naz hcofit s 54=3 2-2-O
SolutioE2,6y
clasSmate
Date
Pagege13
Given Nitemns where each item has some weight kprcfit
2550siated withit Z
qiven o24 ith capacity WCie,the baq canhald st mest
Wweiqht in it
The tsk is to putthe items into the bag Such that thesum
of profits associated nith them is the maximum possible.
Note The constraint here is e can either
an item completaly) into the baa 9Y
camat put it at all CIt isfaotposcible te put a
part of an ttem into the bag