2014-10-31 22:21:37 +00:00
|
|
|
:mod:`uheapq` -- heap queue algorithm
|
|
|
|
=====================================
|
2014-10-31 01:37:19 +00:00
|
|
|
|
|
|
|
.. module:: uheapq
|
|
|
|
:synopsis: heap queue algorithm
|
|
|
|
|
2017-07-02 13:37:31 +01:00
|
|
|
|see_cpython_module| :mod:`python:heapq`.
|
|
|
|
|
2014-10-31 01:37:19 +00:00
|
|
|
This module implements the heap queue algorithm.
|
|
|
|
|
|
|
|
A heap queue is simply a list that has its elements stored in a certain way.
|
|
|
|
|
|
|
|
Functions
|
|
|
|
---------
|
|
|
|
|
|
|
|
.. function:: heappush(heap, item)
|
|
|
|
|
|
|
|
Push the ``item`` onto the ``heap``.
|
|
|
|
|
|
|
|
.. function:: heappop(heap)
|
|
|
|
|
2014-11-27 23:26:08 +00:00
|
|
|
Pop the first item from the ``heap``, and return it. Raises IndexError if
|
2014-10-31 01:37:19 +00:00
|
|
|
heap is empty.
|
|
|
|
|
|
|
|
.. function:: heapify(x)
|
|
|
|
|
|
|
|
Convert the list ``x`` into a heap. This is an in-place operation.
|