0
/ 10
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at position "last".
Which one of the four lines indicated by the comments contains the error?
public static int minVal(int[] y, int first, int last) {
int bestSoFar = y[first]; // line 1
for (int i=first+1; i<=last; i++)
{
if ( y[i] < y[bestSoFar] ) // line 2
bestSoFar = i; // line 3
} // for
return bestSoFar; // line 4
} // method minVal
Your feedback will appear here when you check your answer.