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.
2802 Points
1480 Points
1432 Points
1334 Points
1311 Points
1180 Points
1072 Points
894 Points
868 Points
848 Points
1306 Points
1058 Points
502 Points
292 Points
266 Points
Gatecse
@Arjun Sir the problem is not with the ...