mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 04:31:55 +08:00
Update the section of heap.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user