 recall that
we implemented the
Selection Sort algorithm
to sort any type of data
public class SelSort
{
public static void sort(Comparable[] a)
{
int i, j, min_j; // Array indices
Comparable help; // helper variable for 3way exchange
/* 
The selection sort algorithm
 */
for ( i = 0 ; i < a.length ; i ++ )
{
/* 
Find array element with min. value among
a[i], a[i+1], ..., a[n1]
 */
min_j = i; // Assume elem i (a[i]) is the minimum
for ( j = i+1 ; j < a.length ; j++ )
{
if ( a[j].compareTo(a[min_j]) < 0 )
{
min_j = j; // We found a smaller minimum, update min_j
}
}
/* 
Swap a[i] and a[min_j] (3way exchange)
 */
help = a[i];
a[i] = a[min_j];
a[min_j] = help;
}
}
}

