摘要: Python3 heapq # 默认小根堆 Heap = [] # 初始化为空 heapq.heapify(list) # 将一个list原地转换为堆,线性时间 heapq.heappush(Heap, item) # 插入一个元素 item,类型随意 x, (x, y) 均可 Top = heap 阅读全文
posted @ 2023-01-02 08:38 ccz9729 阅读(23) 评论(0) 推荐(0) 编辑