Created
June 18, 2020 04:48
-
-
Save umangshrestha/51f8340d4a8298a0f851c147c19b6ebe to your computer and use it in GitHub Desktop.
This file contains 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 partition(array, low, high): | |
pivot = array[high] | |
i = low - 1 | |
for j in range(low , high): | |
if array[j] < pivot: | |
print(array) | |
i = i + 1 | |
array[i], array[j] = array[j], array[i] | |
array[high], array[i + 1] = array[i + 1], array[high] | |
return i + 1 | |
def quickSort(array, low, high): | |
if low < high: | |
pi = partition(array, low, high) | |
quickSort(array, pi+1, high) | |
quickSort(array, low, pi-1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment