Skip to content
Snippets Groups Projects
Commit 44a4a99f authored by nilsl99's avatar nilsl99
Browse files

Fixed InsertionSort

parent f9487630
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,7 @@ def InsertionSort(array): ...@@ -64,7 +64,7 @@ def InsertionSort(array):
sorted_array = list(array) sorted_array = list(array)
for i in range(1, len(array)): for i in range(1, len(array)):
for j in range(i, 1, -1): for j in range(i, 0, -1):
if sorted_array[j] < sorted_array[j-1]: if sorted_array[j] < sorted_array[j-1]:
sorted_array[j], sorted_array[j-1] = sorted_array[j-1], sorted_array[j] sorted_array[j], sorted_array[j-1] = sorted_array[j-1], sorted_array[j]
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment