Given 0-1 knapsack problem and fractional knapsack problem and the following statements:
$S_1$: 0-1 knapsack is efficiently solved using Greedy algorithm.
$S_2$: Fractional knapsack is efficiently solved using Dynamic programming.
Which of the following is true?
Show the worked solution\(S_1\): the greedy choice by profit/weight ratio can fail for 0-1 knapsack because an item cannot be split (e.g. capacity 50, items (60,10), (100,20), (120,30): greedy gets 160, optimum is 220). 0-1 knapsack is solved by dynamic programming in \(O(nW)\). So \(S_1\) is not correct.\(S_2\): the fractional knapsack is solved optimally by the greedy ratio rule in \(O(n\lg n)\); dynamic programming is not the efficient method for it. So \(S_2\) is not correct.Answer: C
GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com