1.

What is its wort case time complexity of Heap sort?(a) O(nlogn)(b) O(n^2logn)(c) O(n^2)(d) O(n^3)The question was asked in a national level competition.The above asked question is from Heapsort topic in section Sorting of Data Structures & Algorithms II

Answer»

The correct choice is (a) O(nlogn)

Easy EXPLANATION - In Heap sort, the call to procedure build_Max-heap takes O(N) TIME and each of O(n) calls to the function max_Heapify takes O(logn) time. So the WORST case complexity of Heap sort is O(nlogn).



Discussion

No Comment Found

Related InterviewSolutions