Skip to content

Commit

Permalink
docs/library: Clarify what type of algorithm is implemented in heapq.
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon authored and dpgeorge committed May 18, 2021
1 parent ea2d83e commit 07528d1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/library/uheapq.rst
Expand Up @@ -6,9 +6,11 @@

|see_cpython_module| :mod:`python:heapq`.

This module implements the heap queue algorithm.
This module implements the
`min heap queue algorithm <https://en.wikipedia.org/wiki/Heap_%28data_structure%29>`_.

A heap queue is simply a list that has its elements stored in a certain way.
A heap queue is essentially a list that has its elements stored in such a way
that the first item of the list is always the smallest.

Functions
---------
Expand All @@ -19,8 +21,10 @@ Functions

.. function:: heappop(heap)

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

The returned item will be the smallest item in the ``heap``.

.. function:: heapify(x)

Expand Down

0 comments on commit 07528d1

Please sign in to comment.