

def pivot(self, A, i, j):
    '\n        Fix the pivot as the 1st element\n        In the end, move the pivot to the end of closed set but still inside the closed set, in order to bisect\n\n        pivoting algorithm:\n        p | closed set | open set |\n        | closed set p | open set |\n        '
    p = i
    closed = p
    for ptr in xrange(i, j):
        if (A[ptr] < A[p]):
            closed += 1
            (A[ptr], A[closed]) = (A[closed], A[ptr])
    (A[closed], A[p]) = (A[p], A[closed])
    return closed

dataset/ETHPy150Open algorhythms/LintCode/Median.py Solution.pivot/original