To strictly optimized logN complexity.