< previous page page_1148 next page >

Page 1148
    else
    {                                          // Recursive case
        minSoFar = Minimum(list, length-1);
        if (list[length-1] < minSoFar)
            return list[length-1];
        else
            return minSoFar;
    }
}
We do not provide a code walk-through for this function. A diagram showing the actual parameters for each call appears in Figure 19-7.
Testing: To test this function, we need a driver program that reads values into an array, calls the function, and prints the result. The cases to be tested are the end cases (the minimum value is the first in the list, and the minimum value is the last in the list) and several cases between.
1148-01.gif
Figure 19-7
Execution of
Minimum(list, 5)

 
< previous page page_1148 next page >