mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-30 16:31:08 +00:00
Fixed spacing
This commit is contained in:
parent
9e031e9783
commit
d31387455e
|
@ -42,13 +42,13 @@ def heap_sort(unsorted):
|
||||||
>>> heap_sort([-2, -5, -45])
|
>>> heap_sort([-2, -5, -45])
|
||||||
[-45, -5, -2]
|
[-45, -5, -2]
|
||||||
"""
|
"""
|
||||||
n=len(unsorted)
|
n=len(unsorted)
|
||||||
for i in range (n/2 - 1 , -1, -1):
|
for i in range (n/2 - 1 , -1, -1):
|
||||||
heapify(unsorted,i,n)
|
heapify(unsorted,i,n)
|
||||||
for i in range(n - 1, -1, -1):
|
for i in range(n - 1, -1, -1):
|
||||||
unsorted[0], unsorted[i] = unsorted[i], unsorted[0]
|
unsorted[0], unsorted[i] = unsorted[i], unsorted[0]
|
||||||
heapify(unsorted,0,i)
|
heapify(unsorted,0,i)
|
||||||
return unsorted
|
return unsorted
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user