Created
May 31, 2016 22:30
-
-
Save ta1hia/2320e8b1a02a6c3ec6e82d4a5fa24c88 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: | |
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