Update the section of heap.

This commit is contained in:
krahets
2023-05-25 20:25:19 +08:00
parent b9178bc7d6
commit 11c835d79c
36 changed files with 22 additions and 24 deletions

View File

@ -37,10 +37,8 @@ class MaxHeap {
/* 交换元素 */
#swap(i, j) {
const a = this.#maxHeap[i],
b = this.#maxHeap[j],
tmp = a;
this.#maxHeap[i] = b;
const tmp = this.#maxHeap[i];
this.#maxHeap[i] = this.#maxHeap[j];
this.#maxHeap[j] = tmp;
}