public class SortAlgorithms { public static void selectionSort(Comparable a[]) { for ( int i = 0; i < a.length; i++ ) { int min = i; // trouvez l'element le plus petit dans la // portion non triee du tableau for ( int j = i+1; j < a.length; j++ ) { if ( a[j].compareTo( a[ min ] ) < 0 ) { min = j; } } // echanger l'element et celui en position i Comparable tmp = a[min]; a[min] = a[i]; a[i] = tmp; } } }