#function for doing partitining
from array import array
def partition(array,low,high):
i = low-1
pivot = array[high]
for j in range(low,high):
if array[j] <= pivot:
i = i +1
(array[i] , array[j]) = (array[j], array[i])
(array[i+1],array[high]) = (array[high], array[i+1])
return i+1
# function for quick sort
def quickSort(array, low, high):
if (low<high):
pivot = partition(array,low,high)
quickSort(array,low, pivot-1)
quickSort(array,pivot+1,high)
# driver code
array = [10,7,8,9,1,5]
n = len(array)
print("array before quick sort",array)
quickSort(array,0,n-1)
print("after quicksort",array)