Skip to content

Commit 00b8bff

Browse files
committed
Merge branch 'Develop' into Feature/Tri-insertion
2 parents 0900857 + 09da783 commit 00b8bff

11 files changed

Lines changed: 179 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.class
2+
.idea
3+
untitled104.iml
4+
.DS_Store

Tri-a-bulles-optimise/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry kind="output" path="out/production/untitled104"/>
6+
</classpath>

Tri-a-bulles-optimise/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Tri-a-bulles_optimise</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Tri à bulles optimisé
2+
FONCTION ENTIER TriBulle(tableau: t)
3+
// Définir les variables
4+
VARIABLE
5+
INT: n
6+
BOOLEAN: echange
7+
// Début de l'algorithme
8+
DEBUT
9+
// Initialisation
10+
n <- TAILLE(tableau)
11+
echange <- VRAI
12+
temp
13+
14+
// Tant qu'il y a echange
15+
TANT QUE echange EST VRAI FAIRE
16+
// Initialisation
17+
echange <- FAUX
18+
19+
// On parcourt le tableau
20+
POUR i DE 1 A n FAIRE
21+
// On compare les éléments suivants
22+
SI tableau[i] > tableau[i+1] ALORS
23+
// On échange les valeurs
24+
temp <- tableau[i]
25+
tableau[i] <- tableau[i+1];
26+
tableau[i+1] <- temp;
27+
echange <- VRAI
28+
FIN SI
29+
FIN POUR
30+
FIN TANT QUE
31+
RETOURNE tableau
32+
FIN
33+
FIN FONCTION
34+
// al
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/untitled104/
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Import Arrays
2+
import java.util.Arrays;
3+
4+
public class Main {
5+
6+
public static void main(String[] args) {
7+
// write your code here
8+
// Clear console
9+
System.out.print("\033\033");
10+
11+
// Tableau de test
12+
int[] tableau = { 1, 3, 7, 2, 6, 4, 5, 8, 10, 9 };
13+
14+
System.out.println("Tableau de test : "+Arrays.toString(triBulle(tableau)));
15+
16+
}
17+
18+
public static int[] triBulle(int [] tableau) {
19+
int n = tableau.length;
20+
boolean echange = true;
21+
while (echange) {
22+
echange = false;
23+
for (int i = 0; i < n - 1; i++) {
24+
if (tableau[i] > tableau[i + 1]) {
25+
int temp = tableau[i];
26+
tableau[i] = tableau[i + 1];
27+
tableau[i + 1] = temp;
28+
echange = true;
29+
}
30+
}
31+
}
32+
33+
// Return le resultat
34+
return tableau;
35+
}
36+
}

Tri-de-selection/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

Tri-de-selection/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

Tri-de-selection/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Tri-de-selection</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

Tri-de-selection/Algorithm.algo

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Correspond à la fonction Tri Sélection
2+
FONCTION ENTIER TriSélection(Tableau T)
3+
VARIABLE
4+
ENTIER: i <- 0
5+
ENTIER: v <- 0
6+
ENTIER: pos <- 0
7+
ENTIER: min <- 0
8+
POUR i variant de 0 à N-2
9+
pos <- i
10+
POUR v variant de i+1 à N-1
11+
SI T(v) < T(pos), alors pos <- v
12+
FINSI
13+
FINPOUR
14+
Min <- T(pos)
15+
T(pos) <- T(i)
16+
T(i) <- Min
17+
FINSI
18+
RETOURNER Tableau(T)
19+
FINPOUR
20+
FINFONCTION

0 commit comments

Comments
 (0)