What is the worst-case time complexity of the Heap sort?

2018

What is the worst-case time complexity of the Heap sort?

Answer: C. O(n log n)Heap sort has a worst-case time complexity of O(n log n). This occurs because building the heap takes O(n) and extracting elements takes O(log n) for each of…

  1. A.

    O(n)

  2. B.

    O(n2)

  3. C.

    O(n log n)

  4. D.

    O(n3)

Attempted by 1114 students.

Show answer & explanation

Correct answer: C

Heap sort has a worst-case time complexity of O(n log n). This occurs because building the heap takes O(n) and extracting elements takes O(log n) for each of the n elements.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…