An array of integers of size n can be converted into a heap by adjusting the heaps rooted at each internal node of the complete binary tree starting at the node ?(n?1)/2? and doing this adjustment up to the root node (root node is at index 0) in the order ?(n?1)/2, ?(n?3)/2?, ....., 0.
==========================================================================
I know, it's a Build Heap procedure and takes O(n) time, but can someone please make me visualise by taking a array with small value of n to show how things are working?
See Question&Answers more detail:os