Binary search algorithm.