Which of the following sorting algorithms has the worst time complexity of…
2018
Which of the following sorting algorithms has the worst time complexity of nlog(n)?
Answer: A. Heapsort — Heapsort → Worst case time complexity = O(n log n) Quicksort → Worst case time complexity = O(n²) Insertion sort → Worst case time complexity = O(n²)…
- A.
Heapsort
- B.
Quicksort
- C.
Insertion sort
- D.
Selection sort
Attempted by 1328 students.
Show answer & explanation
Correct answer: A
Heapsort → Worst case time complexity = O(n log n)
Quicksort → Worst case time complexity = O(n²)
Insertion sort → Worst case time complexity = O(n²)
Selection sort → Worst case time complexity = O(n²)
Hence, the sorting algorithm whose worst-case time complexity is n log n is Heapsort.
Loading lesson…