@@ -26,15 +26,15 @@ public static int[] selectedSort(int[] tableau) {
2626 pos = v ;
2727
2828 comparaisons +=1 ;
29- affectations +=1 ;
29+ affectations +=2 ;
3030 }
3131 comparaisons +=1 ;
3232 }
3333 min = tableau [pos ];
3434 tableau [pos ] = tableau [i ];
3535 tableau [i ] = min ;
3636 echanges += 1 ;
37- affectations += 3 ;
37+ affectations += 4 ;
3838 }
3939 return tableau ;
4040 }
@@ -48,8 +48,8 @@ public static void main(String[] args) {
4848 // Tableau de test
4949
5050 // int[] tableau = {10,9,8,7,6,5,4,3,2,1};
51- // int[] tableau = {1,2,3,4,5,6,7,8,9,10};
52- int [] tableau = { rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ), rand .nextInt (100 ) };
51+ int [] tableau = {1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 };
52+ // int[] tableau = { rand.nextInt(100), rand.nextInt(100), rand.nextInt(100), rand.nextInt(100), rand.nextInt(100), rand.nextInt(100), rand.nextInt(100), rand.nextInt(100), rand.nextInt(100), rand.nextInt(100) };
5353
5454 System .out .println ("Tableau d'avant fonction : " + Arrays .toString (tableau ));
5555 System .out .println ("Tableau après fonction : " + Arrays .toString (selectedSort (tableau )));
@@ -66,9 +66,7 @@ public static void main(String[] args) {
6666
6767 public static void stat (int min ,int max , int step , int nbr ) {
6868 int i ;
69- comparaisons = 0 ;
70- echanges = 0 ;
71- affectations = 0 ;
69+
7270 for ( i = 1 ; i <= nbr ; i ++) {
7371 int Tab [] =new Random ().ints (min ).toArray ();
7472 selectedSort (Tab );
0 commit comments