import numpy as np
import numpy
def qucikSort(nums,left=None,right=None):
left = 0 if not isinstance(left,(int,float)) else left
right = len(nums)-1 if not isinstance(right,(int,float)) else right
if left >= right:
return
mid = partion(nums,left,right)
qucikSort(nums,left,mid-1)
qucikSort(nums,mid+1,right)
return nums
def partion(nums,left,right):
pivot = numpy.random.randint(left,right)
nums[pivot],nums[left] = nums[left],nums[pivot]
index = left+1
i = index
while i<=right:
if nums[i]<nums[left]:
nums[i],nums[index] = nums[index],nums[i]
index +=1
i +=1
nums[index-1],nums[left] = nums[left],nums[index-1]
return index-1
res = qucikSort([4,3,5,9,6,1,23,453,13,1])
print(res)