Skip to content

Commit 8d1df54

Browse files
committed
Explicitly use priority queue right leaf access
1 parent 90f7ba2 commit 8d1df54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PriorityQueue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private function swap(int $a, int $b)
194194
private function getLargestLeaf(int $parent)
195195
{
196196
$left = $this->left($parent);
197-
$right = $left + 1;
197+
$right = $this->right($parent);
198198

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

0 commit comments

Comments
 (0)