Open In App

GATE | GATE IT 2006 | Question 72

Like Article
Like
Save
Share
Report

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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads