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...

Click the ________ button in the SmartArt Styles group on the SmartArt Design tab to display the Color gallery

Fill in the blank(s) with correct word

Computer Science & Information Technology

List Paragraph is the default paragraph style applied to bulleted lists

Indicate whether the statement is true or false

Computer Science & Information Technology

A ____ relationship cannot be created directly between two tables in Access.

A. one-to-one B. one-to-many C. many-to-many D. all three types can be directly created with two tables in Access

Computer Science & Information Technology

What information must be supplied when utilizing a method that requires additional information in order to operate?

A. Literal strings B. Primitive data C. Arguments D. Complex data

Computer Science & Information Technology