Fixed spacing

This commit is contained in:
JakeBonek 2016-08-16 15:56:06 -04:00
parent de8c5cbf00
commit 9e031e9783

View File

@ -42,8 +42,8 @@ def heap_sort(unsorted):
>>> heap_sort([-2, -5, -45])
[-45, -5, -2]
"""
n=len(unsorted)
for i in range (n/2 - 1 , -1, -1) :
n=len(unsorted)
for i in range (n/2 - 1 , -1, -1):
heapify(unsorted,i,n)
for i in range(n - 1, -1, -1):
unsorted[0], unsorted[i] = unsorted[i], unsorted[0]
@ -61,4 +61,3 @@ if __name__ == '__main__':
user_input = input_function('Enter numbers separated by a comma:\n')
unsorted = [int(item) for item in user_input.split(',')]
print (heap_sort(unsorted))