Implemented a binary search algorithm.