单选题 适中
#18009

下列归并算法程序中,横线处应该填入的是( ) def merge_sort ( array ) : if len ( array ) == 1 : return…

下列归并算法程序中,横线处应该填入的是( )

def merge_sort(array):
	if len(array) == 1:
		return array
	_________________________
	return merge(left, right)
	
def merge(left, right):
	left_index, right_index, merge_array = 0, 0, list()
	while left_index < len(left) and right_index < len(right):
		if left[left_index] <= right[right_index]:
			merge_array.append(left[left_index])
			left_index += 1
		else:
			merge_array.append(right[right_index])
			right_index += 1
	merge_array = merge_array + left[left_index:] + right[right_index:]
	return merge_array
未登录也能判分,登录后才会记录
答案与解析
正确答案:D
这道题暂未补解析。