in Algorithms recategorized by
7,026 views
1 vote
1 vote

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. $S_1$ is correct and $S_2$ is not correct
  2. Both $S_1$ and $S_2$ are correct
  3. Both $S_1$ and $S_2$ are not correct
  4. $S_1$ is not correct and $S_2$ is correct
in Algorithms recategorized by
7.0k views

1 comment

Fractional Knapsack ------>  both Greedy and DP

0/1 Knapsack----------->Only DP (Greedy fails)
0
0

2 Answers

1 vote
1 vote
0-1 knapsack solved by using Dynamic programming and  Fractional knapsack is solved by using greedy algorithm.

so Both S1 and S2 statement are wrong.
0 votes
0 votes
FRACTIONAL- It can be solved easily by GREEDY method so also by Dynamic

0/1- It can not be done by greedy , here optimal substructrure is required so DYNAMIC method is used

Only S2 is correct
Answer:

Related questions