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)?

  1. A.

    Heapsort

  2. B.

    Quicksort

  3. C.

    Insertion sort

  4. D.

    Selection sort

Attempted by 842 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.

Explore the full course: Up Lt Grade Assistant Teacher 2025