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

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