BinarySearch C++ Implementation