diff --git a/sorts/heap_sort.py b/sorts/heap_sort.py index 822bb6631..f89ae1866 100644 --- a/sorts/heap_sort.py +++ b/sorts/heap_sort.py @@ -7,7 +7,7 @@ or python3 -m doctest -v heap_sort.py For manual testing run: -python insertion_sort.py +python heap_sort.py ''' from __future__ import print_function @@ -46,7 +46,7 @@ def heap_sort(unsorted): n = len(unsorted) for i in range(n//2 - 1, -1, -1): heapify(unsorted, i, n) - for i in range(n - 1, -1, -1): + for i in range(n - 1, 0, -1): unsorted[0], unsorted[i] = unsorted[i], unsorted[0] heapify(unsorted, 0, i) return unsorted