refactor: Replace 'poll' with 'pop' in Heap (#416)

This commit is contained in:
Yudong Jin
2023-03-13 22:31:05 +08:00
committed by GitHub
parent 8aebbaad21
commit 28aacccf44
27 changed files with 91 additions and 152 deletions

View File

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