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

[518 byte] By [jorgebrito02@msn.coma] at [2007-11-26 20:01:55]
# 1

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;

}

}

for ?, my thoughts are stuck there

NasirMunira at 2007-7-9 23:00:47 > top of Java-index,Java Essentials,Java Programming...