Skip to content

Instantly share code, notes, and snippets.

@ta1hia
Created March 10, 2016 21:35
Show Gist options
  • Save ta1hia/2febb4a820717f2686f9 to your computer and use it in GitHub Desktop.
Save ta1hia/2febb4a820717f2686f9 to your computer and use it in GitHub Desktop.
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