BinarySearch and Partition