Implemented binary search and finding first element greater than present