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

@ -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);
}