Which sorting algorithm has a best-case time complexity of O(nlogn) and a worst-case time complexity of O(n^2)?

17 views
  • Quick sort (Correct Answer)
  • Heap sort
  • Merge sort
  • Radix sort

Explanation

Answer: a) Quick sort

Explanation: Quick sort is a divide-and-conquer algorithm that works by selecting a "pivot" element and partitioning the array into two sub-arrays based on the pivot. Its best-case time complexity is O(nlogn) and its worst-case time complexity is O(n^2), depending on the choice of pivot.

Comments (0)

No comments yet. Be the first to comment!

Want to practice more?

Explore thousands of MCQs across every exam category on Exams Nepal.

Find More MCQs