def merge(A, p, q, r): n1 = q - p + 1 n2 = r - q L = list(range(n1 + 1)) R = list(range(n2 + 1)) for i in range(0, n1): L[i] = A[p + i] for j in range(0, n2): R[j] = A[q + j + 1] L[n1] = 10000 #这里可以使用无穷大/也可以使用一个比数组最大的元素大的值 R[n2] = 10000 i = 0 j