We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8cc3231 commit c822875Copy full SHA for c822875
src/data-structures/heap.js
@@ -82,7 +82,8 @@
82
}
83
84
if (right < this._heap.length &&
85
- this._cmp(this._heap[right], this._heap[index]) > 0) {
+ this._cmp(this._heap[right], this._heap[index]) > 0 &&
86
+ this._cmp(this._heap[right], this._heap[left]) > 0) {
87
extr = right;
88
89
@@ -116,6 +117,7 @@
116
117
index = parent;
118
parent = Math.floor(parent / 2);
119
120
+ this._heapify(index);
121
122
return parent;
123
};
0 commit comments