mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-19 07:17:54 +08:00
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:
@@ -14,7 +14,7 @@ class MaxHeap:
|
||||
"""大顶堆"""
|
||||
|
||||
def __init__(self, nums: list[int]):
|
||||
"""构造方法"""
|
||||
"""构造方法,根据输入列表建堆"""
|
||||
# 将列表元素原封不动添加进堆
|
||||
self.max_heap = nums
|
||||
# 堆化除叶节点以外的其他所有节点
|
||||
|
||||
Reference in New Issue
Block a user