Heapify (H, i)

The above Procedure fixes the heap for index ‘i’ where ‘i’ refers to the index such that the tree rooted at H[i] is a heap. This Procedure recursively calls itself until the given heap is fixed.

Step 1 Left child, and right child, initialization

set l Lchild (i)

set r Rchild (i)

Step 2 Place the maximum value, left child

if (l heap-size [H] and H [l] > H[i]) then

set max l

else

set max i

Step 3 Place the maximum value, right child

if (r heap-size [H] and H [r] > H [max]) then

set max r

Step 4 Checking with parent

if (max i) then

set H [i] H [max]

Step 5 fixing of heap

Call to Heapify (H, max)

## 4 comments:

Thanks to the writer of this article. I appreciate your effort in making this informational blogs. I know it's not easy to do this but you have done a really great job. Congrats. I'm pretty sure your readers enjoying it a lots.

Rica

www.imarksweb.org

Thanks to the writer of this article. I appreciate your effort in making this informational blogs. I know it's not easy to do this but you have done a really great job. Congrats. I'm pretty sure your readers enjoying it a lots.

Rica

www.imarksweb.org

Thanks for sharing such a wonderful article, I hope you could inspire more people. Visit my site too.

n8fan.net

www.n8fan.net

I found your blog website on google and test a few of your early posts. Proceed to maintain up the superb operate. I simply extra up your RSS feed to my MSN News Reader. In search of forward to reading extra from you later on!… online casino bonus

Post a Comment