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. HeapsortHeapsort → Worst case time complexity = O(n log n) Quicksort → Worst case time complexity = O(n²) Insertion sort → Worst case time complexity = O(n²)…

  1. A.

    Heapsort

  2. B.

    Quicksort

  3. C.

    Insertion sort

  4. 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.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…