228 views
0 votes
0 votes
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 minheap
property. What is the time taken to convert the given tree ‘T’ to a max heap ?
a. Ο(log n)
b. Ο(n)
c. Ο(n log n)
d. Ο(n2)

1 Answer

0 votes
0 votes
Answer is O(logn) as we need to perform heapify procedure only at the root and heapify procedure takes O(height=logn)

Related questions

0 votes
0 votes
0 answers
1
2 votes
2 votes
0 answers
2
0 votes
0 votes
1 answer
4
shefali1 asked Jan 31, 2017
186 views
An upper layer packet is split into 20 frames each of which has 80 percent chance of arriving undamaged. No error control is done by data link layer. The number of times ...