GATE | GATE IT 2006 | Question 72

An array X of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is 0. If only the root node does not satisfy the heap property, the algorithm to convert the complete binary tree into a heap has the best asymptotic time complexity of
(A) O (n)
(B) O (log n)
(C) O (nlog n)
(D) O (n log log n)

Answer: (B)

Explanation: It takes O(logn) to heapify an element of heap

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.