Skip to content

Instantly share code, notes, and snippets.

@tahia-khan tahia-khan/qsort.py
Created May 31, 2016

Embed
What would you like to do?
def qsort(A, L, U):
if L < U:
T = A[L]
M = L #pivot
for i in range(L+1, U):
if A[i] < T:
M += 1
tmp = A[M]
A[M] = A[i]
A[i] = tmp
A[L] = A[M]
A[M] = T
qsort(A, L, M)
qsort(A, M+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.