Which of the following statements about sorting algorithms is true?

15 views
  • Merge Sort has a worst-case time complexity of O(n^2)
  • Quick Sort is a stable sorting algorithm
  • Bubble Sort is an adaptive sorting algorithm
  • Heap Sort has a worst-case time complexity of O(log n) (Correct Answer)

Explanation

Answer: d) Heap Sort has a worst-case time complexity of O(log n)
Explanation:
Heap Sort has a worst-case time complexity of O(n log n). This is because it builds a binary heap out of the array and then repeatedly extracts the maximum element from the heap until the entire array is sorted. The binary heap can be built in O(n) time, and each extraction takes O(log n) time, so the overall time complexity is O(n log n).

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