摘要: 参考:https://zhongqiang.blog.csdn.net/article/details/115319669 Python的heapq模块默认建立小顶堆 1. 建堆 两种方式: 一种是使用空列表,然后 heapq.heappush() 函数把值加入,另外一种是 heap.heapify 阅读全文
posted @ 2022-05-11 19:28 麦克斯的园丁 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 参考:https://zhongqiang.blog.csdn.net/article/details/115319669 class S(): def __init__(self) -> None: pass # 堆排序 def heapify(self, tree, n, i): """把父节点 阅读全文
posted @ 2022-05-11 19:00 麦克斯的园丁 阅读(73) 评论(0) 推荐(0) 编辑