mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
Update the section of heap.
This commit is contained in:
@ -41,10 +41,8 @@ class MaxHeap {
|
||||
|
||||
/* 交换元素 */
|
||||
private void swap(int i, int j) {
|
||||
int a = maxHeap.get(i);
|
||||
int b = maxHeap.get(j);
|
||||
int tmp = a;
|
||||
maxHeap.set(i, b);
|
||||
int tmp = maxHeap.get(i);
|
||||
maxHeap.set(i, maxHeap.get(j));
|
||||
maxHeap.set(j, tmp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user