Skip to content

Commit

Permalink
fix(heaps): update pushPop() comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jan 17, 2021
1 parent ba1c8e3 commit f530236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/heaps/src/heap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class Heap<T>

pushPop(val: T, vals = this.values) {
const head = vals[0];
if (vals.length > 0 && this.compare(head, val) < 0) {
if (vals.length > 0 && this.compare(head, val) <= 0) {
vals[0] = val;
val = head;
this.percolateDown(0, vals);
Expand Down

0 comments on commit f530236

Please sign in to comment.