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

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