change partition algorithm