def pivot(self, A, i, j):
        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
Fix the pivot as the 1st element
dataset/ETHPy150Open algorhythms/LintCode/Median.py/Solution.pivot