Read the following Selection Sort function and determine the correct answer for blank #2.
template
int MinIndex(ItemType values[], int startIndex, int endIndex)
// Post: Returns the index of the smallest value in
// values[startIndex]..values[endIndex].
{
int indexOfMin = __________; // 1
for (int index = startIndex + 1; index <= endIndex; index++)
if (values[index] < ________________) // 2
indexOfMin = index;
return indexOfMin;
}
template
void SelectionSort(ItemType values[], int numValues)
// Post: The elements in the array values are sorted by key.
{
int endIndex = ____________; // 3
for (int current = 0; current < endIndex; ___________) // 4
Swap(values[current],
values[MinIndex(values, current, __________)]); // 5
}
a. values[indexOfMin]
b. indexOfMin
c. values[startIndex]