We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 41205d6 + cde6e8a commit c20acfbCopy full SHA for c20acfb
src/data-structures/heaps/heap.js
@@ -59,7 +59,7 @@ class Heap {
59
*/
60
bubbleUp() {
61
let index = this.size - 1;
62
- const parent = (i) => Math.ceil(i / 2 - 1);
+ const parent = (i) => Math.ceil(i / 2) - 1;
63
while (parent(index) >= 0 && this.comparator(parent(index), index) > 0) {
64
this.swap(parent(index), index);
65
index = parent(index);
0 commit comments