diff options
author | Brett Cannon <brett@python.org> | 2021-05-16 20:11:44 -0700 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-05-18 12:24:21 +1000 |
commit | 07528d1f855cf7a970913477b40c664700a0aa4d (patch) | |
tree | c0ceeb9da8f138b23c42bafba4f2bde20c82bd26 | |
parent | ea2d83e96175ef1ed260cca917024502e01a5546 (diff) |
docs/library: Clarify what type of algorithm is implemented in heapq.
-rw-r--r-- | docs/library/uheapq.rst | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/library/uheapq.rst b/docs/library/uheapq.rst index f822f1e7f..9ae1f61a1 100644 --- a/docs/library/uheapq.rst +++ b/docs/library/uheapq.rst @@ -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 --------- @@ -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) |