Skip to content

Commit

Permalink
change name
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Feb 17, 2025
1 parent 24a2065 commit 695af3e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/internal/priority_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ module.exports = class PriorityQueue {
const item = heap[pos];

while (pos <= hsize) {
let left = pos << 1;
const right = left + 1;
let child = heap[left];
let child = pos << 1;
const nextChild = child + 1;
let childItem = heap[child];

if (right <= size && compare(heap[right], child) < 0) {
left = right;
child = heap[right];
if (nextChild <= size && compare(heap[nextChild], childItem) < 0) {
child = nextChild;
childItem = heap[nextChild];
}

if (compare(item, child) <= 0) break;
if (compare(item, childItem) <= 0) break;

if (setPosition !== undefined)
setPosition(child, pos);
setPosition(childItem, pos);

heap[pos] = child;
pos = left;
heap[pos] = childItem;
pos = child;
}

heap[pos] = item;
Expand Down

0 comments on commit 695af3e

Please sign in to comment.