src/PriorityQueue.php
private function getLargestLeaf(int $parent)
    {
        $left  = $this->left($parent);
        $right = $this->right($parent);

        if ($right < count($this->heap) && $this->compare($left, $right) < 0) {
            return $right;
        }

        return $left;
    }
private function getLargestLeaf(int $parent)
    {
        $left  = $this->left($parent);
        $right = $this->right($parent);

        if ($right < count($this->heap) && $this->compare($left, $right) < 0) {
            return $right;
        }

        return $left;
    }
private function getLargestLeaf ( int $ parent ) { $ left = $ this -> left ( $ parent ) ; $ right = $ this -> right ( $ parent ) ; if ( $ right < count ( $ this -> heap ) && $ this -> compare ( $ left , $ right ) < 0 ) { return $ right ; } return $ left ; }
Returns the index of a node's largest leaf node.

@param int $parent the parent node.

@return int the index of the node's largest leaf node.
Returns the index of a node s largest leaf node .