def quick_sort(data):
if len(data) >= 2:
mid = data[len(data)//2]
left,right = [], []
data.remove(mid)
for num in data:
if num >= mid:
right.append(num)
else:
left.append(num)
return quick_sort(left) + [mid] + quick_sort(right)
else:
return data
————————————————
版权声明:本文为CSDN博主「Coach_C」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_40294256/article/details/95173232