We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e031e9 commit d313874Copy full SHA for d313874
sorts/heap_sort.py
@@ -42,13 +42,13 @@ def heap_sort(unsorted):
42
>>> heap_sort([-2, -5, -45])
43
[-45, -5, -2]
44
"""
45
-n=len(unsorted)
46
-foriinrange (n/2-1 , -1, -1):
47
-heapify(unsorted,i,n)
48
-foriinrange(n-1, -1, -1):
49
-unsorted[0], unsorted[i] =unsorted[i], unsorted[0]
50
-heapify(unsorted,0,i)
51
-returnunsorted
+n=len(unsorted)
+foriinrange (n/2-1 , -1, -1):
+heapify(unsorted,i,n)
+foriinrange(n-1, -1, -1):
+unsorted[0], unsorted[i] =unsorted[i], unsorted[0]
+heapify(unsorted,0,i)
+returnunsorted
52
53
54
if__name__=='__main__':
0 commit comments