第26628题 单选题
为使快速排序函数支持多种常见可迭代类型,横线处应填入的代码是?

上题不能支持其他常见类型的排序,如实现该支持,横线处分别应填写代码是( )。

def qSort(iterData):
    if _________________________:
        _________________________
    else:
        lst = iterData

    if len(lst) <= 1:
        return lst
    else:
        Pivot = lst[0]
        Less = [x for x in lst[1:] if x <= Pivot]
        Greater = [x for x in lst[1:] if x > Pivot]
        return qSort(Less) + [Pivot] + qSort(Greater)

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