Implemented binarySearch.