initial binary search algorithm