9 lines
216 B
Python
9 lines
216 B
Python
def insertion_sort(lst):
|
|
|
|
for i in range(1, len(lst)):
|
|
key = lst[i]
|
|
j = i - 1
|
|
while j >= 0 and key < lst[j]:
|
|
lst[j + 1] = lst[j]
|
|
j -= 1
|
|
lst[j + 1] = key |