第15341题 单选题
给定Python归并排序代码执行时,merge()函数的总调用次数为多少?
def mergeSort(listData):
    if len(listData) <= 1:
        return listData
    Middle = len(listData) // 2
    Left, Right = mergeSort(listData[:Middle]), mergeSort(listData[Middle:])
    return merge(Left, Right)

def merge(Left, Right):
    Result = []
    i, j = 0 , 0
    while i < len(Left) and j < len(Right):
        if Left[i] <= Right[j]:
            Result.append(Left[i])
            i += 1
        else:
            Result.append(Right[j])
            j += 1
    Result.extend(Left[i:])
    Result.extend(Right[j:])
    return Result

lstA = [1, 3, 2, 7, 11, 5, 3]
lstA = mergeSort(lstA)
print(lstA)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析