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 1c390b3 commit bcdf3e4Copy full SHA for bcdf3e4
problems/0347.前K个高频元素.md
@@ -421,7 +421,7 @@ class Heap {
421
let left = 1; // left 是左子节点下标 left + 1 则是右子节点下标
422
let searchChild = this.compare(left, left + 1) > 0 ? left + 1 : left;
423
424
- while (searchChild !== undefined && this.compare(index, searchChild) > 0) { // 注意compare参数顺序
+ while (this.compare(index, searchChild) > 0) { // 注意compare参数顺序
425
[this.queue[index], this.queue[searchChild]] = [this.queue[searchChild], this.queue[index]];
426
427
// 更新下标
0 commit comments