Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Why does the value/weight ratio greedy strategy …

Why does the value/weight ratio greedy strategy not always solve 0/1 knapsack optimally?

Athe ratio computation is too slow
Bgreedy is forbidden by NP-completeness
Citems must be sorted in linear time, but sorting needs n log n
Ditems can't be split, so a high-ratio item may block better combinations
Answer & Solution
Correct answer: D. items can't be split, so a high-ratio item may block better combinations
0/1 forbids splitting. Greedy may grab a single high-ratio item that fills most of the knapsack, leaving no room for two slightly-lower-ratio items whose combined value would have been higher. Fractional knapsack avoids this trap by letting you take a fraction of the next item. The non-splittability of 0/1 is exactly what breaks greedy.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions