You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
201 B
9 lines
201 B
13 years ago
|
def insertion_sort(A):
|
||
|
for j in range(1, len(A)):
|
||
|
key = A[j]
|
||
|
i = j - 1
|
||
|
while i >= 0 and A[i] > key:
|
||
|
A[i + 1] = A[i]
|
||
|
i = i - 1
|
||
|
A[i + 1] = key
|