Hey
I am a bit confused on how the Recursive heapify process works.
So tell me If I have this right:
It first goes to the left subtree until it reaches the last Node, it then starts the tickleup process and continues like that.
It then goes to right subtree and does the same
Here is some code:
heapify(int index) // transform array into heap
{
if(index > N/2-1) // if node has no children,
return; // return
heapify(index*2+2); // turn right subtree into heap
heapify(index*2+1); // turn left subtree into heap
trickleDown(index); // apply trickle-down to this node
}
Thanks