Skip to content

Instantly share code, notes, and snippets.

@tahia-khan tahia-khan/qsort.py
Created Mar 10, 2016

Embed
What would you like to do?
def qsort(A, L, U):
if L < U:
P = A[L]
W = L
for i in range(L, U):
if A[i] < P:
W += 1
tmp = A[i]
A[i] = A[W]
A[W] = tmp
A[L] = A[W]
A[W] = P
qsort(A, L, W)
qsort(A, W+1, U)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.