feat: Add the section of Top-K problem (#551)

* Add the section of Top-K problem

* Update my_heap.py

* Update build_heap.md

* Update my_heap.py
This commit is contained in:
Yudong Jin
2023-06-12 23:04:01 +08:00
committed by GitHub
parent 9de5d0bff2
commit a111b94f23
22 changed files with 266 additions and 16 deletions

View File

@@ -14,7 +14,7 @@ class MaxHeap:
"""大顶堆"""
def __init__(self, nums: list[int]):
"""构造方法"""
"""构造方法,根据输入列表建堆"""
# 将列表元素原封不动添加进堆
self.max_heap = nums
# 堆化除叶节点以外的其他所有节点