posted 17 years ago
im using selectionSort to sort an array of integers that i will create later. For example int a[MAX]; <---this will be my array. I know this sorts an array of objects, but what about integers?
public static void selectionSort(Comparable[] list)
{
int min;
Comparable temp;
for(int index=0; index<list.length-1; index++)
{ min=index;
for(int scan=index+1; scan<list.length; scan++)
if(list[scan].compareTo(list[min] < 0)
min=scan;
temp = list[min];
list[min]=list[index];
list[index]=temp;
}
}