C++ implementation
int BinSearch(const int A[], int First, int Last, int Value)
// POST: if Value is in the array, returns the
// index of the array element that
// equals Value; Otherwise returns -1.
{
if (First > Last) return -1; // base case 1
Previous slide
Next slide
Back to first slide
View graphic version