➤ Greedy algo does not give optimal solution everytime. Exa. Consider n=3 and Capacity W=30 w={20,10,5} p={180,80,50} p/w={9,8,10} greedy solution={1,0,1} ➝ profit =180+50=230 optimal solution={1,1,0} ➝ profit=180+80=260 Algo :- w[i] gives weight of ith item. p[i] gives value(profit) of ith item. sol[i][j] gives the maximum profit for i items and j capacity(sub problem) Use Desktop Version Of This Site For Better View. for(j=0 to m) ➝ No Capicity No Packets sol[0][j]=0 for(i=0 to m) ➝ No Items sol[i][0]=0 for(i=1 to n) for(j=1 to m) if(w[i] > j) ...