Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t=[0,7,6,0,7,0,2,1]
- #Quick Sort
- def QuickSort(t:list):
- le = []
- eq = []
- gr = []
- if len(t) > 1:
- pivot = t[0]
- for x in t:
- if x < pivot:
- le.append(x)
- elif x == pivot:
- eq.append(x)
- elif x > pivot:
- gr.append(x)
- return QuickSort(le)+eq+QuickSort(gr)
- else:
- return t
- print(QuickSort(t))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement