def merge(sort_list, start, mid, end):
left_list = sort_list[start:mid]
right_list = sort_list[mid:end]
left_list.append(float("inf"))
right_list.append(float("inf"))
left_index = right_index = 0
i = start
while i < end:
if left_list[left_index] < right_list[right_index]:
sort_list[i] = left_list[left_index]
left_index += 1
else:
sort_list[i] = right_list[right_index]
right_index += 1
i += 1
时间: 2024-10-10 15:11:20