Created
March 10, 2016 21:35
-
-
Save ta1hia/2febb4a820717f2686f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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