We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de8c5cb commit 9e031e9Copy full SHA for 9e031e9
sorts/heap_sort.py
@@ -42,8 +42,8 @@ def heap_sort(unsorted):
42
>>> heap_sort([-2, -5, -45])
43
[-45, -5, -2]
44
"""
45
- n=len(unsorted)
46
- for i in range (n/2 - 1 , -1, -1) :
+ n=len(unsorted)
+ for i in range (n/2 - 1 , -1, -1):
47
heapify(unsorted,i,n)
48
for i in range(n - 1, -1, -1):
49
unsorted[0], unsorted[i] = unsorted[i], unsorted[0]
@@ -61,4 +61,3 @@ def heap_sort(unsorted):
61
user_input = input_function('Enter numbers separated by a comma:\n')
62
unsorted = [int(item) for item in user_input.split(',')]
63
print (heap_sort(unsorted))
64
-
0 commit comments