irongit

Dolphin type neovim.

neovim/samples/quicksort.py
11 lines316 BPython
1# quicksort algorithm
2def quicksort(l):
3 if len(l) <= 1:
4 return l
5 pivot = l[len(l) // 2]
6 left = [x for x in l if x < pivot]
7 middle = [x for x in l if x == pivot]
8 right = [x for x in l if x > pivot]
9 return quicksort(left) + middle + quicksort(right)
10
11print(quicksort([3,6,8,10,1,2,1]))