UGC-NET Sep 2013 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0039

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?
  1. A
    $S_1$ is correct and $S_2$ is not correct
  2. B
    Both $S_1$ and $S_2$ are correct
  3. C
    Both $S_1$ and $S_2$ are not correct
  4. D
    $S_1$ is not correct and $S_2$ is correct

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

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