We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 15d6ba2 + d73ee43 commit ddc6db2Copy full SHA for ddc6db2
1 file changed
LearningJavaScriptDataStructuresandAlgorithmsThirdEdition_Code/src/js/data-structures/heap.js
@@ -88,7 +88,7 @@ export class MinHeap {
88
this.heap = array;
89
}
90
const maxIndex = Math.floor(this.size() / 2) - 1;
91
- for (let i = 0; i <= maxIndex; i++) {
+ for (let i = maxIndex; i >= 0; i--) {
92
this.siftDown(i);
93
94
return this.heap;
0 commit comments