Q. Time complexity of fractional knapsack problem is

  • (A) o(n log n)
  • (B) o(n)
  • (C) o(n2)
  • (D) o(nw)
πŸ’¬ Discuss
βœ… Correct Answer: (A) o(n log n)
Explanation: as the main time taking a step is of sorting so it defines the time complexity of our code. so the time complexity will be o(n log n) if we use quick sort for sorting.

Explanation by: Mr. Dubey
as the main time taking a step is of sorting so it defines the time complexity of our code. so the time complexity will be o(n log n) if we use quick sort for sorting.

πŸ’¬ Discussion

πŸ“Š Question Analytics

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