mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-22 15:53:50 +08:00
Update the section of heap.
This commit is contained in:
@ -36,10 +36,8 @@ class MaxHeap {
|
||||
|
||||
/* 交换元素 */
|
||||
private swap(i: number, j: number): void {
|
||||
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