teendev
6/6/2018 - 6:06 PM

Part C

Part C

#Implement the Partition Function
def partition(A,start,stop):
    pivot = A[stop]
    i = start
    for j in range(start, stop, 1):
        if not A[j] > pivot:
            temp = A[j]
            A[j] = A[i]
            A[i] = temp
            i += 1
    
    temp = A[i]
    A[i] = A[stop]
    A[stop] = temp
    
    return i