# Max heap

108 views
Conversion of binary search tree into a Max heap takes:

O(n) time

O(nlog n) time

None
0
n time to compare n elements in the worst case and logn time to arrange each at correct position node thus takes O (nlogn) time for heapify

Any form of binary search tree can be converted into a complete binary tree in $\Theta(n)$ time.

And heapification of a complete binary tree into a max or a min heap can be done in $\Theta(n)$ time.

Overall , time would be $\Theta(n)$+$\Theta(n)$ = $\Theta(n)$
0
It's because binary search tree can be stored in array which will take O (n) time then it can be converted into heap in O (n) time right

## Related questions

1
195 views
what is the time complexity of various problems such as: 1) Creating the heap 2) Getting maximum element in the max heap 3) Getting minimum element in the max heap 4) Getting maximum element in min heap 5) Getting minimum element in min heap 6) Heapify the element 7) ... ) Deletion of an element in the max heap 10) Insertion of an element in the max heap 11) Insertion of an element in min heap