Skip to content

Commit df271bf

Browse files
Merge pull request TheAlgorithms#25 from yyeltsyn/patch-3
Update heap_sort.py
2 parents ba37aef + bb70803 commit df271bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sorts/heap_sort.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
python3 -m doctest -v heap_sort.py
88
99
For manual testing run:
10-
python insertion_sort.py
10+
python heap_sort.py
1111
'''
1212

1313
from __future__ import print_function
@@ -46,7 +46,7 @@ def heap_sort(unsorted):
4646
n = len(unsorted)
4747
for i in range(n//2 - 1, -1, -1):
4848
heapify(unsorted, i, n)
49-
for i in range(n - 1, -1, -1):
49+
for i in range(n - 1, 0, -1):
5050
unsorted[0], unsorted[i] = unsorted[i], unsorted[0]
5151
heapify(unsorted, 0, i)
5252
return unsorted

0 commit comments

Comments
 (0)