# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 将给定数组排序 # @param arr int整型一维数组 待排序的数组 # @return int整型一维数组 # class Solution: def MySort(self , arr: List[int]) -> List[int]: # write code here # 快速排序 if len(arr)<=1: return arr middle = len(arr)//2 divider = arr[middle] left = [x for x in arr if x<divider] equal = [x for x in arr if x==divider] right = [ x for x in arr if x>divider] return self.MySort(left)+equal+self.MySort(right)