mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-16 13:40:58 +00:00
build
This commit is contained in:
+11
-4
@@ -362,7 +362,11 @@ comments: true
|
||||
=== "C"
|
||||
|
||||
```c title="my_heap.c"
|
||||
[class]{maxHeap}-[func]{left}
|
||||
|
||||
[class]{maxHeap}-[func]{right}
|
||||
|
||||
[class]{maxHeap}-[func]{parent}
|
||||
```
|
||||
|
||||
=== "C#"
|
||||
@@ -472,7 +476,7 @@ comments: true
|
||||
=== "C"
|
||||
|
||||
```c title="my_heap.c"
|
||||
|
||||
[class]{maxHeap}-[func]{peek}
|
||||
```
|
||||
|
||||
=== "C#"
|
||||
@@ -668,7 +672,9 @@ comments: true
|
||||
=== "C"
|
||||
|
||||
```c title="my_heap.c"
|
||||
[class]{maxHeap}-[func]{push}
|
||||
|
||||
[class]{maxHeap}-[func]{siftUp}
|
||||
```
|
||||
|
||||
=== "C#"
|
||||
@@ -821,8 +827,7 @@ comments: true
|
||||
void poll() {
|
||||
// 判空处理
|
||||
if (empty()) {
|
||||
cout << "Error:堆为空" << endl;
|
||||
return;
|
||||
throw out_of_range("堆为空");
|
||||
}
|
||||
// 交换根结点与最右叶结点(即交换首元素与尾元素)
|
||||
swap(maxHeap[0], maxHeap[size() - 1]);
|
||||
@@ -977,7 +982,9 @@ comments: true
|
||||
=== "C"
|
||||
|
||||
```c title="my_heap.c"
|
||||
[class]{maxHeap}-[func]{poll}
|
||||
|
||||
[class]{maxHeap}-[func]{siftDown}
|
||||
```
|
||||
|
||||
=== "C#"
|
||||
@@ -1156,7 +1163,7 @@ comments: true
|
||||
=== "C"
|
||||
|
||||
```c title="my_heap.c"
|
||||
|
||||
[class]{maxHeap}-[func]{newMaxHeap}
|
||||
```
|
||||
|
||||
=== "C#"
|
||||
|
||||
Reference in New Issue
Block a user