
Heapq
screaming
这个作者很懒,什么都没留下…
展开
-
heapq
.4. heapq — Heap queue algorithm New in version 2.3. Source code: Lib/heapq.py This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm转载 2016-06-18 18:25:04 · 427 阅读 · 0 评论 -
python heapq
python heapq 这个模块(build-in)实现了一个堆的数据结构,完美的解决了Top-K问题,以后解决Top-K问题的时候,直接把这个模块拿来用就可以了 注意,默认的heap是一个小顶堆! heapq模块提供了如下几个函数: heapq.heappush(heap, item) 把item添加到heap中(heap是一个列表) heapq.he转载 2016-06-18 18:50:03 · 647 阅读 · 0 评论