binary-search
unknown
c_cpp
a month ago
318 B
4
Indexable
Never
int Search(int a[], int start, int last, int item) { int mid; if(last >= start) { mid = (start + last)/2; if(a[mid] == item){ return mid+1; } else if(a[mid] < item){ return Search(a,start,mid+1,item); } else{ return Search(a,mid-1,last,item); } } return -1; }
Leave a Comment