πŸ“Š Design and Analysis of Algorithms
Q. Fractional knapsack problem is solved most efficiently by which of the following algorithm?
  • (A) divide and conquer
  • (B) dynamic programming
  • (C) greedy algorithm
  • (D) backtracking
πŸ’¬ Discuss
βœ… Correct Answer: (C) greedy algorithm

Explanation: greedy algorithm is used to solve this problem. we first sort items according to their value/weight ratio and then add item with highest ratio until we cannot add the next item as a whole. at the end, we add the next item as much as we can.


Explanation by: Mr. Dubey
greedy algorithm is used to solve this problem. we first sort items according to their value/weight ratio and then add item with highest ratio until we cannot add the next item as a whole. at the end, we add the next item as much as we can.

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
154
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
86%
Success Rate