insertion sort help please
// is this code correct? please help
// Trace the insertion sort as it sorts the following array into ascednding order:
// 20 80 40 25 60 40
public static void selectionSort(Comparable[] theArray, int n) {
for ( int last 20, 80, 40, 25, 60, 40) {
int largest = indexOfLargest(theArray, last+1);
Comparable temp = theArray[largest];
theArray[largest] = theArray[last];
theArray[last] = temp;
}
}
Message was edited by:
jorgebrito02@msn.com

