C++ implementation (Contd.)
else {
int Mid = (First + Last)/2;
if (Value == A[Mid])
return Mid; // base case 2
else if (Value < A[Mid])
return BinSearch (A, First, Mid -1, Value);
else return BinSearch(A, Mid+1, Last, Value);
} //else
}//BinSearch
Previous slide
Next slide
Back to first slide
View graphic version