adaptive partition algorithm