Skip to content

Commit

Permalink
Merge pull request TheAlgorithms#25 from yyeltsyn/patch-3
Browse files Browse the repository at this point in the history
Update heap_sort.py
  • Loading branch information
dynamitechetan authored Sep 2, 2016
2 parents ba37aef + bb70803 commit df271bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sorts/heap_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
python3 -m doctest -v heap_sort.py
For manual testing run:
python insertion_sort.py
python heap_sort.py
'''

from __future__ import print_function
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit df271bf

Please sign in to comment.