Write a method that accepts an array of integers as a parameter and sorts them using the selection sort algorithm.

What will be an ideal response?

```
public void selectionSort(int [] array)
{
int minIndex, temp;
for(int i = 0; i < array.length; i++)
{
minIndex = i;
for(int j = i+1; j < array.length; j++)
{
if(array[j] < array[minIndex])
minIndex = j;

}//end for j
temp = array[i];
array[i] = array[minIndex];
array[minIndex] = temp;
}//end for i
}
```

Computer Science & Information Technology

You might also like to view...

An analog POTS voice line is no longer working and Kim, the technician, is tasked to verify if a dial tone is present at the IDF. Which of the following tools would be used?

A. Protocol analyzer B. Butt set C. OTDR D. Toner probe

Computer Science & Information Technology

An enumeration type can be passed as a parameter to a function only by value.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology