lpublic
void selectSort()
l// Sorts array into ascending
l{
String temp; int passCount; int sIndex;
l int minIndex; // index of minimum so far
l for(passCount = 0; passCount <
numItems-1; passCount++)
l { minIndex = passCount;
l //
find index of smallest remaining
l for(sIndex = passCount + 1; sIndex <
numItems; sIndex++)
l
if(listItems[sIndex].compareTo(listItems[minIndex])<0)
l
minIndex = sIndex;
l temp = listItems[minIndex]; // swap
l listItems[minIndex]
= listItems[passCount];
l listItems[passCount] = temp;
l }
l}