用于python的heapq模块的最大堆版本。
heapq_max的Python项目详细描述
说明
用于python的heapq模块的maxheap版本。类似于HEAPQ,C 实现可用于确保性能。
依赖关系
python 2或3
安装
pip install heapq_max
用法
tl;dr:与heapq模块相同,只是在所有函数中添加了'u max'。
from heapq_max import * heap_max = [] # creates an empty heap heappush_max(heap_max, item) # pushes a new item on the heap item = heappop_max(heap_max) # pops the largest item from the heap item = heap_max[0] # largest item on the heap without popping it heapify_max(x) # transforms list into a heap, in-place, in linear time item = heapreplace_max(heap_max, item) # pops and returns largest item, and # adds new item; the heap size is unchanged
许可证
麻省理工学院
历史记录
0.21
下载url&readme的小补丁
0.2
添加Python2支持
0.1&0.11
第一个版本,仅支持Python3