So i\'m trying to implement a binary min heap. I understand what the binary min heap entails in terms of it\'s structure and it\'s properties. However I\'m hitting a wall when I
Use this function to reach desired node:
function find_node($n)
{
$current_node = $n;
while($current_node > 1)
{
if($current_node % 2 == 1) // if node is odd it is a right child
{
push($stack,"Right");
}
else // otherwise it is even and left child
{
push($stack,"Left");
}
$current_node = floor($current_node / 2); // set the current node to the parent
}
return $stack; // this stack now contains the path to node n
}