Given the following list { 10,9,-2,1}, sort the list using selection sort and fill out the following table. static void selectionSort(double [] list) { // find minimum in the list [i....list.length-1]...


Given the following list { 10,9,-2,1}, sort the list using selection sort and fill out the following table.


static void selectionSort(double [] list) {
// find minimum in the list [i....list.length-1]
for (int i=0;i
double currentMin=list[i];
int currentMinIndex=i;
for (int j=i+1;j
if (currentMin>list[j])
{
currentMin=list[j];
currentMinIndex=j;
}
}// j for
// swap list[i] with list[currentMindIndex if
necessary.
if (currentMinIndex!=i) {
list[currentMinIndex]=list[i];
list[i]=currentMin;
}// if
}// for
}


currnetMin<br>currnetMinlndex<br>The list<br>

Extracted text: currnetMin currnetMinlndex The list

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here