Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Doc/library/heapq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ entry as removed and add a new entry with the revised priority::
Theory
------

Heaps are arrays for which ``a[k] <= a[2*k+1]`` and ``a[k] <= a[2*k+2]`` for all
Min-heaps are arrays for which ``a[k] <= a[2*k+1]`` and ``a[k] <= a[2*k+2]`` for all
*k*, counting elements from 0. For the sake of comparison, non-existing
elements are considered to be infinite. The interesting property of a heap is
that ``a[0]`` is always its smallest element.
elements are considered to be infinite. The interesting property of a min-heap is
that ``a[0]`` is always its smallest element. Max-heaps satisfy the reverse invariant.

The strange invariant above is meant to be an efficient memory representation
The strange min-heap invariant is meant to be an efficient memory representation
for a tournament. The numbers below are *k*, not ``a[k]``::

0
Expand Down