有关以下Python实现的qSort()排序函数的说法,正确的是哪个?
def qSort(lst):
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)
lstA = [1,2,11,12,21,21,2,3,41,4,3]
lstB = qSort(lstA)
print(lstA,lstB)
正在加载题目数据…
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析