Anybody please help me understanding Minheapify method from this link .I am not getting what is actually going on there.And please mention some question on heaps if you remember.
What we are doing is recursively doing,the following steps:
- Get the index of the smallest element out of three --> the root, the left child and the right child…
If the smallest index is the root then return… - Else wise swap the root with the lowest element and now rrecursively call heapify for the next level with index (treated as root in the next call) as the index
Upvote
1 Like
Wow…thanks please give me some questions if you remember
See questions on this site at the bottom… Graph theory is the place (and sorting for higher number of elements with no extra space is an advantage of heaps)
https://github.com/yanhan/competitive-programming/tree/master/minmaxheap