- 时间复杂度O(n2)
- 稳定排序
def insert_sort(arr):
if len(arr) <= 1:
return
for i in range(1, len(arr)):
j = i
while j > 0:
if arr[j] < arr[j - 1]:
arr[j], arr[j - 1] = arr[j - 1], arr[j]
j -= 1
else:
break