mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-26 21:16:07 +00:00
build
This commit is contained in:
@@ -1256,7 +1256,7 @@ comments: true
|
||||
if (l < this.size() && this.#maxHeap[l] > this.#maxHeap[ma]) ma = l;
|
||||
if (r < this.size() && this.#maxHeap[r] > this.#maxHeap[ma]) ma = r;
|
||||
// 若节点 i 最大或索引 l, r 越界,则无需继续堆化,跳出
|
||||
if (ma == i) break;
|
||||
if (ma === i) break;
|
||||
// 交换两节点
|
||||
this.#swap(i, ma);
|
||||
// 循环向下堆化
|
||||
@@ -1292,7 +1292,7 @@ comments: true
|
||||
if (l < this.size() && this.maxHeap[l] > this.maxHeap[ma]) ma = l;
|
||||
if (r < this.size() && this.maxHeap[r] > this.maxHeap[ma]) ma = r;
|
||||
// 若节点 i 最大或索引 l, r 越界,则无需继续堆化,跳出
|
||||
if (ma == i) break;
|
||||
if (ma === i) break;
|
||||
// 交换两节点
|
||||
this.swap(i, ma);
|
||||
// 循环向下堆化
|
||||
|
||||
Reference in New Issue
Block a user