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

@ -36,11 +36,9 @@ class MaxHeap {
/* 交换元素 */
void _swap(int i, int j) {
int a = _maxHeap[i];
int b = _maxHeap[j];
int tem = a;
_maxHeap[i] = b;
_maxHeap[j] = tem;
int tmp = _maxHeap[i];
_maxHeap[i] = _maxHeap[j];;
_maxHeap[j] = tmp;
}
/* 获取堆大小 */