Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Быстрая сортировка
- """
- def quickSort(arr):
- if len(arr) < 2: return arr
- else:
- pivot = arr[0]
- less = [i for i in arr[1:] if i <= pivot]
- greator = [i for i in arr[1:] if i > pivot]
- return quickSort(less) + [pivot] + quickSort(greator)
- print(quickSort([10, 5, 2, 3])) # массив, который надо отсортировать
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement