src/PriorityQueue.php
private function siftUp(int $leaf)
    {
        for (; $leaf > 0; $leaf = $parent) {
            $parent = $this->parent($leaf);

            // Done when parent priority is greater.
            if ($this->compare($leaf, $parent) < 0) {
                break;
            }

            $this->swap($parent, $leaf);
        }
    }
private function siftUp(int $leaf)
    {
        for (; $leaf > 0; $leaf = $parent) {
            $parent = $this->parent($leaf);

            // Done when parent priority is greater.
            if ($this->compare($leaf, $parent) < 0) {
                break;
            }

            $this->swap($parent, $leaf);
        }
    }
private function siftUp ( int $ leaf ) { for ( ; $ leaf > 0 ; $ leaf = $ parent ) { $ parent = $ this -> parent ( $ leaf ) ; // Done when parent priority is greater. if ( $ this -> compare ( $ leaf , $ parent ) < 0 ) { break ; } $ this -> swap ( $ parent , $ leaf ) ; } }
Sifts a node up the heap until it's in the right position.

@param int $leaf
Sifts a node up the heap until it s in the right position .