def quicksort(nums):
left=[]
right=[]
l=len(nums)
if l<=1:
return nums
else:
for i in range(1,l):
if nums[i]>=nums[0]:
right.append(nums[i])
else:
left.append(nums[i])
left=quicksort(left)
right=quicksort(right)
left.append(nums[0])
left.extend(right)
return left
<每日一题>快速排序
最新推荐文章于 2022-03-17 10:04:51 发布