Which of the following sorting algorithms has the worst-time complexity of n(…
2018
Which of the following sorting algorithms has the worst-time complexity of n( log n)?
- A.
Heapsort
- B.
Quicksort
- C.
Insertion sort
- D.
Selection sort
Attempted by 659 students.
Show answer & explanation
Correct answer: A
Heapsort has worst-case time complexity = O(n log n). Quicksort’s worst case is O(n²), while Insertion and Selection sorts are O(n²)