用于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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带truezip的java拆分zip   java Spring,AppEngine:在AppEngine的数据源中添加postgresql url   java Android coverflow   java以编程方式创建复合过滤器,以在log4j 2中定义多个过滤器   java jpa eclipselink异常[eclipselink 4002]   中的java WordNet数据库目录相对路径。罐子   java无法在Spring Boot 2/3中显示登录的用户   java Onetomany:未找到联接表错误   java数据模型演化   java方法在类型列表中添加的(对象)不适用于参数(int)意味着什么?   用java打印两个数组   java SNMP4J发送从不超时   java添加/删除联系人(EditText)+类别(SpinnerBox),可以根据需要动态添加/删除多个联系人   语句和PreparedStatement之间的java差异   java在运行作为JAR归档文件分发的项目时加载图像等资源   来自应用程序或外部服务器的java Cron作业   多线程Java并发:并发添加和清除列表项   java更改单元测试的私有方法行为