Consider a complete Binary Tree ‘T’ with key of root node be ‘P’. It is given that the left and right subtree of ‘P’ satisfies min-heap property. What is the time taken to convert the given tree ‘T’ to a max heap ?
a)O(log N)
b) O(N)
Apply Build_Max_Heap procedure on the tree, which takes O(N) time.
if the question is
Consider a complete Binary Tree ‘T’ with key of root node be ‘P’. It is given that the left and right subtree of ‘P’ satisfies min-heap property. What is the time taken to convert the given tree ‘T’ to a min heap ?
then answer should be log N, rt?
The answer should be O(N) as we need to to heapify all the nodes in botton up fashion.
3796 Points
2716 Points
2292 Points
2142 Points
1888 Points
1786 Points
1702 Points
1690 Points
1624 Points
1614 Points
Gatecse
@Uzumaki
There are some previous years ...