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:
@ -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;
|
||||
}
|
||||
|
||||
/* 获取堆大小 */
|
||||
|
||||
Reference in New Issue
Block a user