def qsort2(data: list):
if len(data) <= 1:
return data
pivot = data[len(data) - 1]
left_list = []
right_list = []
for i in range(len(data) - 1):
value = data[i]
if value > pivot:
right_list.append(value)
else:
left_list.append(value)
return qsort2(left_list) + [pivot] + qsort2(right_list)
python快排
最新推荐文章于 2024-03-15 20:21:22 发布