python3
利用匿名函数简化代码
def quick_sort(arr):
if len(arr) <= 1:
return arr
else:
pivot = arr[len(arr)//2]
less = [x for x in arr if x < pivot]
mid = [x for x in arr if x == pivot]
greater = [x for x in arr if x > pivot]
return quick_sort(less) + mid + quick_sort(greater)
n = int(input())
input_arr = list(map(int, input().split()))
sorted_arr = quick_sort(input_arr)
print(" ".join(list(map(str, sorted_arr))))