summaryrefslogtreecommitdiffstatshomepage
path: root/docs/library/uheapq.rst
blob: 05c8ad1759182e4f875a7a72e8dc26dade697830 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
:mod:`uheapq` --- heap queue algorithm
======================================

.. module:: uheapq
   :synopsis: heap queue algorithm

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)

   Pop the first item froh the ``heap``, and return it.  Raises IndexError if
   heap is empty.

.. function:: heapify(x)

   Convert the list ``x`` into a heap.  This is an in-place operation.