def find_index(nums, low, high):
key = nums[low]
while low < high:
while low < high and key <= nums[high]:
high -= 1
while low < high and key > nums[high]:
nums[low] = nums[high]
low += 1
nums[high] = nums[low]
nums[low] = key
return low
def quick_sort(nums, low, high):
if low < high:
index = find_index(nums)
quick_sort(nums, low, index)
quick_sort(nums, index+1, high)
find_index()是为了找到nums中某一个值在nums中应该的位置