BinarySearch is a simple implementation of a binary search algorithm.