diff --git a/codes/c/chapter_heap/my_heap.c b/codes/c/chapter_heap/my_heap.c index 1c0766e6f..afb8ce367 100644 --- a/codes/c/chapter_heap/my_heap.c +++ b/codes/c/chapter_heap/my_heap.c @@ -86,7 +86,7 @@ int push(maxHeap *h, int val) { } /* 元素出堆 */ -int poll(maxHeap *h) { +int pop(maxHeap *h) { // 判空处理 if (isEmpty(h)) { printf("heap is empty!"); @@ -162,7 +162,7 @@ int main() { printHeap(heap->data, heap->size); /* 堆顶元素出堆 */ - int top = poll(heap); + int top = pop(heap); printf("\n堆顶元素 %d 出堆后\n", top); printHeap(heap->data, heap->size); diff --git a/codes/cpp/chapter_heap/heap.cpp b/codes/cpp/chapter_heap/heap.cpp index 336f0168d..67e1bf0a9 100644 --- a/codes/cpp/chapter_heap/heap.cpp +++ b/codes/cpp/chapter_heap/heap.cpp @@ -13,7 +13,7 @@ void testPush(priority_queue &heap, int val) PrintUtil::printHeap(heap); } -void testPoll(priority_queue &heap) +void testPop(priority_queue &heap) { int val = heap.top(); heap.pop(); @@ -43,11 +43,11 @@ int main() cout << "\n堆顶元素为 " << peek << endl; /* 堆顶元素出堆 */ - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); /* 获取堆大小 */ int size = maxHeap.size(); diff --git a/codes/cpp/chapter_heap/my_heap.cpp b/codes/cpp/chapter_heap/my_heap.cpp index 6a22d242c..96f628cbb 100644 --- a/codes/cpp/chapter_heap/my_heap.cpp +++ b/codes/cpp/chapter_heap/my_heap.cpp @@ -96,7 +96,7 @@ public: } /* 元素出堆 */ - void poll() { + void pop() { // 判空处理 if (empty()) { throw out_of_range("堆为空"); @@ -121,48 +121,35 @@ public: }; -void testPush(MaxHeap maxHeap, int val) { - maxHeap.push(val); - cout << "\n添加元素 " << val << " 后" << endl; - maxHeap.print(); -} - -void testPop(MaxHeap maxHeap) { - int val = maxHeap.peek(); - maxHeap.poll(); - cout << "\n出堆元素为 " << val << endl; - maxHeap.print(); -} - /* Driver Code */ int main() { /* 初始化大顶堆 */ vector vec{9, 8, 6, 6, 7, 5, 2, 1, 4, 3, 6, 2}; - MaxHeap maxheap(vec); + MaxHeap maxHeap(vec); cout << "\n输入列表并建堆后" << endl; - maxheap.print(); + maxHeap.print(); /* 获取堆顶元素 */ - int peek = maxheap.peek(); + int peek = maxHeap.peek(); cout << "\n堆顶元素为 " << peek << endl; /* 元素入堆 */ int val = 7; - maxheap.push(val); + maxHeap.push(val); cout << "\n元素 " << val << " 入堆后" << endl; - maxheap.print(); + maxHeap.print(); /* 堆顶元素出堆 */ - peek = maxheap.peek(); - maxheap.poll(); + peek = maxHeap.peek(); + maxHeap.pop(); cout << "\n堆顶元素 " << peek << " 出堆后" << endl; - maxheap.print(); + maxHeap.print(); /* 获取堆大小 */ - int size = maxheap.size(); + int size = maxHeap.size(); cout << "\n堆元素数量为 " << size << endl; /* 判断堆是否为空 */ - bool isEmpty = maxheap.empty(); + bool isEmpty = maxHeap.empty(); cout << "\n堆是否为空 " << isEmpty << endl; } diff --git a/codes/csharp/chapter_heap/heap.cs b/codes/csharp/chapter_heap/heap.cs index 214b6842e..f13889bed 100644 --- a/codes/csharp/chapter_heap/heap.cs +++ b/codes/csharp/chapter_heap/heap.cs @@ -18,7 +18,7 @@ public class heap PrintUtil.printHeap(heap); } - public void testPoll(PriorityQueue heap) + public void testPop(PriorityQueue heap) { int val = heap.Dequeue(); // 堆顶元素出堆 Console.WriteLine($"\n堆顶元素 {val} 出堆后\n"); @@ -47,11 +47,11 @@ public class heap /* 堆顶元素出堆 */ // 出堆元素会形成一个从大到小的序列 - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); /* 获取堆大小 */ int size = maxHeap.Count; diff --git a/codes/csharp/chapter_heap/my_heap.cs b/codes/csharp/chapter_heap/my_heap.cs index 3a408bae2..5321c92e7 100644 --- a/codes/csharp/chapter_heap/my_heap.cs +++ b/codes/csharp/chapter_heap/my_heap.cs @@ -97,7 +97,7 @@ class MaxHeap } /* 元素出堆 */ - public int poll() + public int pop() { // 判空处理 if (isEmpty()) @@ -168,7 +168,7 @@ public class my_heap maxHeap.print(); /* 堆顶元素出堆 */ - peek = maxHeap.poll(); + peek = maxHeap.pop(); Console.WriteLine($"堆顶元素 {peek} 出堆后"); maxHeap.print(); diff --git a/codes/go/chapter_heap/heap_test.go b/codes/go/chapter_heap/heap_test.go index db3844efa..12af16449 100644 --- a/codes/go/chapter_heap/heap_test.go +++ b/codes/go/chapter_heap/heap_test.go @@ -76,7 +76,7 @@ func TestMyHeap(t *testing.T) { maxHeap.print() /* 堆顶元素出堆 */ - peek = maxHeap.poll() + peek = maxHeap.pop() fmt.Printf("\n堆顶元素 %d 出堆后\n", peek) maxHeap.print() diff --git a/codes/go/chapter_heap/my_heap.go b/codes/go/chapter_heap/my_heap.go index e621f6187..65e43e071 100644 --- a/codes/go/chapter_heap/my_heap.go +++ b/codes/go/chapter_heap/my_heap.go @@ -94,7 +94,7 @@ func (h *maxHeap) siftUp(i int) { } /* 元素出堆 */ -func (h *maxHeap) poll() any { +func (h *maxHeap) pop() any { // 判空处理 if h.isEmpty() { fmt.Println("error") diff --git a/codes/go/chapter_tree/binary_tree_bfs.go b/codes/go/chapter_tree/binary_tree_bfs.go index 8ec46fbe7..4ace9fcfe 100644 --- a/codes/go/chapter_tree/binary_tree_bfs.go +++ b/codes/go/chapter_tree/binary_tree_bfs.go @@ -18,7 +18,7 @@ func levelOrder(root *TreeNode) []int { // 初始化一个切片,用于保存遍历序列 nums := make([]int, 0) for queue.Len() > 0 { - // poll + // 队首元素出队 node := queue.Remove(queue.Front()).(*TreeNode) // 保存结点值 nums = append(nums, node.Val) diff --git a/codes/go/pkg/tree_node.go b/codes/go/pkg/tree_node.go index 6baed50eb..560fc4f07 100644 --- a/codes/go/pkg/tree_node.go +++ b/codes/go/pkg/tree_node.go @@ -36,7 +36,7 @@ func ArrToTree(arr []any) *TreeNode { queue.PushBack(root) i := 0 for queue.Len() > 0 { - // poll + // 队首元素出队 node := queue.Remove(queue.Front()).(*TreeNode) i++ if i < len(arr) { diff --git a/codes/java/chapter_heap/heap.java b/codes/java/chapter_heap/heap.java index 1ac63527c..c29550004 100644 --- a/codes/java/chapter_heap/heap.java +++ b/codes/java/chapter_heap/heap.java @@ -12,12 +12,12 @@ import java.util.*; public class heap { public static void testPush(Queue heap, int val) { - heap.add(val); // 元素入堆 + heap.offer(val); // 元素入堆 System.out.format("\n元素 %d 入堆后\n", val); PrintUtil.printHeap(heap); } - public static void testPoll(Queue heap) { + public static void testPop(Queue heap) { int val = heap.poll(); // 堆顶元素出堆 System.out.format("\n堆顶元素 %d 出堆后\n", val); PrintUtil.printHeap(heap); @@ -44,11 +44,11 @@ public class heap { System.out.format("\n堆顶元素为 %d\n", peek); /* 堆顶元素出堆 */ - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); - testPoll(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); + testPop(maxHeap); /* 获取堆大小 */ int size = maxHeap.size(); diff --git a/codes/java/chapter_heap/my_heap.java b/codes/java/chapter_heap/my_heap.java index 6b862f714..c3341d0b7 100644 --- a/codes/java/chapter_heap/my_heap.java +++ b/codes/java/chapter_heap/my_heap.java @@ -87,7 +87,7 @@ class MaxHeap { } /* 元素出堆 */ - public int poll() { + public int pop() { // 判空处理 if (isEmpty()) throw new EmptyStackException(); @@ -129,18 +129,6 @@ class MaxHeap { public class my_heap { - public static void testPush(MaxHeap maxHeap, int val) { - maxHeap.push(val); // 元素入堆 - System.out.format("\n添加元素 %d 后\n", val); - maxHeap.print(); - } - - public static void testPoll(MaxHeap maxHeap) { - int val = maxHeap.poll(); // 堆顶元素出堆 - System.out.format("\n出堆元素为 %d\n", val); - maxHeap.print(); - } - public static void main(String[] args) { /* 初始化大顶堆 */ MaxHeap maxHeap = new MaxHeap(Arrays.asList(9, 8, 6, 6, 7, 5, 2, 1, 4, 3, 6, 2)); @@ -158,7 +146,7 @@ public class my_heap { maxHeap.print(); /* 堆顶元素出堆 */ - peek = maxHeap.poll(); + peek = maxHeap.pop(); System.out.format("\n堆顶元素 %d 出堆后\n", peek); maxHeap.print(); diff --git a/codes/javascript/chapter_heap/my_heap.js b/codes/javascript/chapter_heap/my_heap.js index f5c790e4e..10cb2f8c1 100644 --- a/codes/javascript/chapter_heap/my_heap.js +++ b/codes/javascript/chapter_heap/my_heap.js @@ -82,7 +82,7 @@ class MaxHeap { } /* 元素出堆 */ - poll() { + pop() { // 判空处理 if (this.isEmpty()) throw new Error("堆为空"); // 交换根结点与最右叶结点(即交换首元素与尾元素) @@ -119,18 +119,6 @@ class MaxHeap { } } -function testPush(maxHeap, val) { - maxHeap.push(val); // 元素入堆 - console.log(`\n添加元素 ${val} 后`); - maxHeap.print(); -} - -function testPoll(maxHeap) { - let val = maxHeap.poll(); // 堆顶元素出堆 - console.log(`\n出堆元素为 ${val}`); - maxHeap.print(); -} - /* Driver Code */ /* 初始化大顶堆 */ const maxHeap = new MaxHeap([9, 8, 6, 6, 7, 5, 2, 1, 4, 3, 6, 2]); @@ -148,7 +136,7 @@ console.log(`\n元素 ${val} 入堆后`); maxHeap.print(); /* 堆顶元素出堆 */ -peek = maxHeap.poll(); +peek = maxHeap.pop(); console.log(`\n堆顶元素 ${peek} 出堆后`); maxHeap.print(); diff --git a/codes/python/chapter_heap/my_heap.py b/codes/python/chapter_heap/my_heap.py index 4f34348bd..3d1557759 100644 --- a/codes/python/chapter_heap/my_heap.py +++ b/codes/python/chapter_heap/my_heap.py @@ -67,7 +67,7 @@ class MaxHeap: # 循环向上堆化 i = p - def poll(self) -> int: + def pop(self) -> int: """ 元素出堆 """ # 判空处理 assert not self.is_empty() @@ -102,18 +102,6 @@ class MaxHeap: print_heap(self.max_heap) -def test_push(max_heap: MaxHeap, val: int): - max_heap.push(val) # 元素入堆 - print(f"\n添加元素 {val} 后\n") - max_heap.print() - - -def test_poll(max_heap: MaxHeap): - val = max_heap.poll() # 堆顶元素出堆 - print(f"\n出堆元素为 {val}\n") - max_heap.print() - - """ Driver Code """ if __name__ == "__main__": # 初始化大顶堆 @@ -132,7 +120,7 @@ if __name__ == "__main__": max_heap.print() # 堆顶元素出堆 - peek = max_heap.poll() + peek = max_heap.pop() print(f"\n堆顶元素 {peek} 出堆后") max_heap.print() diff --git a/codes/swift/chapter_heap/my_heap.swift b/codes/swift/chapter_heap/my_heap.swift index b85d57f27..273daceab 100644 --- a/codes/swift/chapter_heap/my_heap.swift +++ b/codes/swift/chapter_heap/my_heap.swift @@ -81,7 +81,7 @@ class MaxHeap { } /* 元素出堆 */ - func poll() -> Int { + func pop() -> Int { // 判空处理 if isEmpty() { fatalError("堆为空") @@ -148,7 +148,7 @@ enum MyHeap { maxHeap.print() /* 堆顶元素出堆 */ - peek = maxHeap.poll() + peek = maxHeap.pop() print("\n堆顶元素 \(peek) 出堆后") maxHeap.print() diff --git a/codes/typescript/chapter_heap/my_heap.ts b/codes/typescript/chapter_heap/my_heap.ts index 3cceef34f..67a12592c 100644 --- a/codes/typescript/chapter_heap/my_heap.ts +++ b/codes/typescript/chapter_heap/my_heap.ts @@ -81,7 +81,7 @@ class MaxHeap { } /* 元素出堆 */ - public poll(): number { + public pop(): number { // 判空处理 if (this.isEmpty()) throw new RangeError('Heap is empty.'); // 交换根结点与最右叶结点(即交换首元素与尾元素) @@ -118,18 +118,6 @@ class MaxHeap { } } -function testPush(maxHeap: MaxHeap, val: number): void { - maxHeap.push(val); // 元素入堆 - console.log(`\n添加元素 ${val} 后`); - maxHeap.print(); -} - -function testPoll(maxHeap: MaxHeap): void { - const val = maxHeap.poll(); // 堆顶元素出堆 - console.log(`\n出堆元素为 ${val}`); - maxHeap.print(); -} - /* Driver Code */ /* 初始化大顶堆 */ const maxHeap = new MaxHeap([9, 8, 6, 6, 7, 5, 2, 1, 4, 3, 6, 2]); @@ -147,7 +135,7 @@ console.log(`\n元素 ${val} 入堆后`); maxHeap.print(); /* 堆顶元素出堆 */ -peek = maxHeap.poll(); +peek = maxHeap.pop(); console.log(`\n堆顶元素 ${peek} 出堆后`); maxHeap.print(); diff --git a/codes/zig/chapter_heap/my_heap.zig b/codes/zig/chapter_heap/my_heap.zig index 060e6b1c0..d7115ca64 100644 --- a/codes/zig/chapter_heap/my_heap.zig +++ b/codes/zig/chapter_heap/my_heap.zig @@ -94,7 +94,7 @@ pub fn MaxHeap(comptime T: type) type { } // 元素出堆 - pub fn poll(self: *Self) !T { + pub fn pop(self: *Self) !T { // 判断处理 if (self.isEmpty()) unreachable; // 交换根结点与最右叶结点(即交换首元素与尾元素) @@ -171,7 +171,7 @@ pub fn main() !void { try maxHeap.print(mem_allocator); // 堆顶元素出堆 - peek = try maxHeap.poll(); + peek = try maxHeap.pop(); std.debug.print("\n堆顶元素 {} 出堆后\n", .{peek}); try maxHeap.print(mem_allocator); diff --git a/docs/chapter_heap/heap.assets/heap_poll_step1.png b/docs/chapter_heap/heap.assets/heap_pop_step1.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step1.png rename to docs/chapter_heap/heap.assets/heap_pop_step1.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step10.png b/docs/chapter_heap/heap.assets/heap_pop_step10.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step10.png rename to docs/chapter_heap/heap.assets/heap_pop_step10.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step2.png b/docs/chapter_heap/heap.assets/heap_pop_step2.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step2.png rename to docs/chapter_heap/heap.assets/heap_pop_step2.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step3.png b/docs/chapter_heap/heap.assets/heap_pop_step3.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step3.png rename to docs/chapter_heap/heap.assets/heap_pop_step3.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step4.png b/docs/chapter_heap/heap.assets/heap_pop_step4.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step4.png rename to docs/chapter_heap/heap.assets/heap_pop_step4.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step5.png b/docs/chapter_heap/heap.assets/heap_pop_step5.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step5.png rename to docs/chapter_heap/heap.assets/heap_pop_step5.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step6.png b/docs/chapter_heap/heap.assets/heap_pop_step6.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step6.png rename to docs/chapter_heap/heap.assets/heap_pop_step6.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step7.png b/docs/chapter_heap/heap.assets/heap_pop_step7.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step7.png rename to docs/chapter_heap/heap.assets/heap_pop_step7.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step8.png b/docs/chapter_heap/heap.assets/heap_pop_step8.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step8.png rename to docs/chapter_heap/heap.assets/heap_pop_step8.png diff --git a/docs/chapter_heap/heap.assets/heap_poll_step9.png b/docs/chapter_heap/heap.assets/heap_pop_step9.png similarity index 100% rename from docs/chapter_heap/heap.assets/heap_poll_step9.png rename to docs/chapter_heap/heap.assets/heap_pop_step9.png diff --git a/docs/chapter_heap/heap.md b/docs/chapter_heap/heap.md index 61eb538e7..c549402a1 100644 --- a/docs/chapter_heap/heap.md +++ b/docs/chapter_heap/heap.md @@ -19,17 +19,17 @@ 而恰好,**堆的定义与优先队列的操作逻辑完全吻合**,大顶堆就是一个元素从大到小出队的优先队列。从使用角度看,我们可以将「优先队列」和「堆」理解为等价的数据结构。因此,本文与代码对两者不做特别区分,统一使用「堆」来命名。 -堆的常用操作见下表(方法命名以 Java 为例)。 +堆的常用操作见下表,方法名需根据编程语言确定。
-| 方法 | 描述 | 时间复杂度 | -| --------- | -------------------------------------------- | ----------- | -| add() | 元素入堆 | $O(\log n)$ | -| poll() | 堆顶元素出堆 | $O(\log n)$ | -| peek() | 访问堆顶元素(大 / 小顶堆分别为最大 / 小值) | $O(1)$ | -| size() | 获取堆的元素数量 | $O(1)$ | -| isEmpty() | 判断堆是否为空 | $O(1)$ | +| 方法名 | 描述 | 时间复杂度 | +| --------- | ------------------------------------------ | ----------- | +| push() | 元素入堆 | $O(\log n)$ | +| pop() | 堆顶元素出堆 | $O(\log n)$ | +| peek() | 访问堆顶元素(大 / 小顶堆分别为最大 / 小值) | $O(1)$ | +| size() | 获取堆的元素数量 | $O(1)$ | +| isEmpty() | 判断堆是否为空 | $O(1)$ |
@@ -49,11 +49,11 @@ Queue maxHeap = new PriorityQueue<>((a, b) -> b - a); /* 元素入堆 */ - maxHeap.add(1); - maxHeap.add(3); - maxHeap.add(2); - maxHeap.add(5); - maxHeap.add(4); + maxHeap.offer(1); + maxHeap.offer(3); + maxHeap.offer(2); + maxHeap.offer(5); + maxHeap.offer(4); /* 获取堆顶元素 */ int peek = maxHeap.peek(); // 5 @@ -217,11 +217,11 @@ /* 堆顶元素出堆 */ // 调用 heap.Interface 的方法,来移除元素 - heap.Pop(maxHeap) - heap.Pop(maxHeap) - heap.Pop(maxHeap) - heap.Pop(maxHeap) - heap.Pop(maxHeap) + heap.Pop(maxHeap) // 5 + heap.Pop(maxHeap) // 4 + heap.Pop(maxHeap) // 3 + heap.Pop(maxHeap) // 2 + heap.Pop(maxHeap) // 1 /* 获取堆大小 */ size := len(*maxHeap) @@ -236,13 +236,13 @@ === "JavaScript" ```javascript title="heap.js" - // JavaScript 未提供内置 heap 类 + // JavaScript 未提供内置 Heap 类 ``` === "TypeScript" ```typescript title="heap.ts" - // TypeScript 未提供内置堆 Heap 类 + // TypeScript 未提供内置 Heap 类 ``` === "C" @@ -291,7 +291,7 @@ === "Swift" ```swift title="heap.swift" - // Swift 未提供内置 heap 类 + // Swift 未提供内置 Heap 类 ``` === "Zig" @@ -597,41 +597,41 @@ 顾名思义,**从顶至底堆化的操作方向与从底至顶堆化相反**,我们比较根结点的值与其两个子结点的值,将最大的子结点与根结点执行交换,并循环以上操作,直到越过叶结点时结束,或当遇到无需交换的结点时提前结束。 === "<1>" - ![堆顶元素出堆步骤](heap.assets/heap_poll_step1.png) + ![堆顶元素出堆步骤](heap.assets/heap_pop_step1.png) === "<2>" - ![heap_poll_step2](heap.assets/heap_poll_step2.png) + ![heap_pop_step2](heap.assets/heap_pop_step2.png) === "<3>" - ![heap_poll_step3](heap.assets/heap_poll_step3.png) + ![heap_pop_step3](heap.assets/heap_pop_step3.png) === "<4>" - ![heap_poll_step4](heap.assets/heap_poll_step4.png) + ![heap_pop_step4](heap.assets/heap_pop_step4.png) === "<5>" - ![heap_poll_step5](heap.assets/heap_poll_step5.png) + ![heap_pop_step5](heap.assets/heap_pop_step5.png) === "<6>" - ![heap_poll_step6](heap.assets/heap_poll_step6.png) + ![heap_pop_step6](heap.assets/heap_pop_step6.png) === "<7>" - ![heap_poll_step7](heap.assets/heap_poll_step7.png) + ![heap_pop_step7](heap.assets/heap_pop_step7.png) === "<8>" - ![heap_poll_step8](heap.assets/heap_poll_step8.png) + ![heap_pop_step8](heap.assets/heap_pop_step8.png) === "<9>" - ![heap_poll_step9](heap.assets/heap_poll_step9.png) + ![heap_pop_step9](heap.assets/heap_pop_step9.png) === "<10>" - ![heap_poll_step10](heap.assets/heap_poll_step10.png) + ![heap_pop_step10](heap.assets/heap_pop_step10.png) 与元素入堆操作类似,**堆顶元素出堆操作的时间复杂度为 $O(\log n)$** 。 === "Java" ```java title="my_heap.java" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{siftDown} ``` @@ -639,7 +639,7 @@ === "C++" ```cpp title="my_heap.cpp" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{siftDown} ``` @@ -647,7 +647,7 @@ === "Python" ```python title="my_heap.py" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{sift_down} ``` @@ -655,7 +655,7 @@ === "Go" ```go title="my_heap.go" - [class]{maxHeap}-[func]{poll} + [class]{maxHeap}-[func]{pop} [class]{maxHeap}-[func]{siftDown} ``` @@ -663,7 +663,7 @@ === "JavaScript" ```javascript title="my_heap.js" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{#siftDown} ``` @@ -671,7 +671,7 @@ === "TypeScript" ```typescript title="my_heap.ts" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{siftDown} ``` @@ -679,7 +679,7 @@ === "C" ```c title="my_heap.c" - [class]{maxHeap}-[func]{poll} + [class]{maxHeap}-[func]{pop} [class]{maxHeap}-[func]{siftDown} ``` @@ -687,7 +687,7 @@ === "C#" ```csharp title="my_heap.cs" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{siftDown} ``` @@ -695,7 +695,7 @@ === "Swift" ```swift title="my_heap.swift" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{siftDown} ``` @@ -703,7 +703,7 @@ === "Zig" ```zig title="my_heap.zig" - [class]{MaxHeap}-[func]{poll} + [class]{MaxHeap}-[func]{pop} [class]{MaxHeap}-[func]{siftDown} ```