Question 1 of 10
Kite-festival wind readings are stored in wind. After the first min-based selectionSort pass, what are the contents of wind?
public static void selectionSort(int[] data)
{
for (int i = 0; i < data.length - 1; i++)
{
int minIndex = i;
for (int j = i + 1; j < data.length; j++)
{
if (data[j] < data[minIndex])
{
minIndex = j;
}
}
int temp = data[i];
data[i] = data[minIndex];
data[minIndex] = temp;
}
}
int[] wind = {11, 4, 8, 15, 6};
selectionSort(wind);
- A. {4, 6, 8, 11, 15}
- B. {4, 11, 8, 15, 6}
- C. {11, 4, 8, 6, 15}
- D. {6, 4, 8, 15, 11}