Added in place partition algorithm