summaryrefslogtreecommitdiffstats
path: root/Doc/library/heapq.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-11-26 08:28:05 (GMT)
committerGeorg Brandl <georg@python.org>2010-11-26 08:28:05 (GMT)
commitb727650e0cc89ffccaf99de46d715bd33ff3b400 (patch)
tree2bf3eba728a93b8434774c023cb175831e24bc50 /Doc/library/heapq.rst
parent0a8e5626ad8d007c25826ad3cd7c0ceea67dc462 (diff)
downloadcpython-b727650e0cc89ffccaf99de46d715bd33ff3b400.zip
cpython-b727650e0cc89ffccaf99de46d715bd33ff3b400.tar.gz
cpython-b727650e0cc89ffccaf99de46d715bd33ff3b400.tar.bz2
Merged revisions 86561-86562,86564-86565,86705,86708,86713 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86561 | georg.brandl | 2010-11-20 12:47:10 +0100 (Sa, 20 Nov 2010) | 1 line #10460: Update indent.pro to match PEP 7 better. ........ r86562 | georg.brandl | 2010-11-20 14:44:41 +0100 (Sa, 20 Nov 2010) | 1 line #10439: document PyCodec C APIs. ........ r86564 | georg.brandl | 2010-11-20 15:08:53 +0100 (Sa, 20 Nov 2010) | 1 line #10460: an even better indent.pro. ........ r86565 | georg.brandl | 2010-11-20 15:16:17 +0100 (Sa, 20 Nov 2010) | 1 line socket.gethostbyname(socket.gethostname()) can fail when host name resolution is not set up correctly; do not fail test_socket if this is the case. ........ r86705 | georg.brandl | 2010-11-23 08:54:19 +0100 (Di, 23 Nov 2010) | 1 line #10468: document Unicode exception creation and access functions. ........ r86708 | georg.brandl | 2010-11-23 09:37:54 +0100 (Di, 23 Nov 2010) | 2 lines #10511: clarification of what heaps are; suggested by Johannes Hoff. ........ r86713 | georg.brandl | 2010-11-23 19:14:57 +0100 (Di, 23 Nov 2010) | 1 line assert.h is also included. Thanks to Savio Sena. ........
Diffstat (limited to 'Doc/library/heapq.rst')
-rw-r--r--Doc/library/heapq.rst11
1 files changed, 6 insertions, 5 deletions
diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst
index b46bd82..a6b9ba2 100644
--- a/Doc/library/heapq.rst
+++ b/Doc/library/heapq.rst
@@ -18,11 +18,12 @@ as the priority queue algorithm.
Latest version of the `heapq Python source code
<http://svn.python.org/view/python/branches/release27-maint/Lib/heapq.py?view=markup>`_
-Heaps are arrays for which ``heap[k] <= heap[2*k+1]`` and ``heap[k] <=
-heap[2*k+2]`` for all *k*, counting elements from zero. For the sake of
-comparison, non-existing elements are considered to be infinite. The
-interesting property of a heap is that ``heap[0]`` is always its smallest
-element.
+Heaps are binary trees for which every parent node has a value less than or
+equal to any of its children. This implementation uses arrays for which
+``heap[k] <= heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k*, counting
+elements from zero. For the sake of comparison, non-existing elements are
+considered to be infinite. The interesting property of a heap is that its
+smallest element is always the root, ``heap[0]``.
The API below differs from textbook heap algorithms in two aspects: (a) We use
zero-based indexing. This makes the relationship between the index for a node