@@ -4,6 +4,7 @@ public class Iteratif {
44 public static float echanges = 0 ;
55 public static float comparaisons = 0 ;
66 public static float affectations = 3 *echanges ;
7+ public static float operations ;
78
89
910
@@ -40,19 +41,24 @@ public static int[] selectedSort(int[] tableau) {
4041 public static void main (String [] args ) {
4142 // write your code here
4243 // Clear console
43- System .out .print ( " \033 [H \033 [2J" );
44+ System .out .flush ( );
4445
46+ Random rand = new Random ();
47+
4548 // Tableau de test
46- int [] tableau = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 };
49+
4750 // int[] tableau = {10,9,8,7,6,5,4,3,2,1};
4851 // int[] tableau = {1,2,3,4,5,6,7,8,9,10};
49-
50- System .out .println ("Tableau de test : " + Arrays .toString (selectedSort (tableau )));
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 ) };
53+
54+ System .out .println ("Tableau d'avant fonction : " + Arrays .toString (tableau ));
55+ System .out .println ("Tableau après fonction : " + Arrays .toString (selectedSort (tableau )));
5156 System .out .println ("Comparaisons : " + comparaisons );
5257 System .out .println ("Echanges : " + echanges );
5358 System .out .println ("Affectations : " + affectations );
59+ System .out .println ("Opérations" + (echanges + affectations + comparaisons ));
5460
55- stat (10 ,20 ,5 ,10 );
61+ // stat(10,20,5,10);
5662
5763 }
5864
0 commit comments