插入排序算法 从原数组中依次读取一个数放入有序数组中的合适位置 Python实现 def insertionSort(A: List[int]) -> None: 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 -= 1 A[i+1] = key 时间复杂度: O( n 2 n^2 n2)