Skip to content
Snippets Groups Projects
Commit 88c58d39 authored by lucie's avatar lucie
Browse files

ajout du tri + dossier version lucie

parent 82c84777
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,7 @@ void retirerNoeud(noeud_t *aRetirer, noeud_t tas[TAILLEMAX]){
i = indiceARetirer;
while(trouver != 1){
if(tas[i].distance > tas[(2*i) +1].distance && tas[(2*i) +1].identifiant != 0){
if(tas[i].distance > tas[(2*i) +1].distance && tas[(2*i) +1].identifiant != 0 && tas[(2*i) +1].distance < tas[(2*i) +2].distance){
inverser2Noeuds(i, (2*i) +1, tas);
i = (2*i) +1;
}
......@@ -95,3 +95,22 @@ void afficherTas(noeud_t tas[TAILLEMAX]){
}
}
void trierTas(noeud_t tasNonTrie[TAILLEMAX]){
int i = 0;
noeud_t tasTrie[TAILLEMAX];
initTas(tasTrie);
while(tasNonTrie[0].identifiant != 0){
tasTrie[i] = tasNonTrie[0];
retirerNoeud(&tasNonTrie[0], tasNonTrie);
i++;
}
i=0;
while(tasTrie[i].identifiant != 0){
tasNonTrie[i] = tasTrie[i];
i++;
}
}
......@@ -75,4 +75,6 @@ void libererNoeud(noeud_t *aLiberer);
*/
void afficherTas(noeud_t tas[TAILLEMAX]);
void trierTas(noeud_t tas[TAILLEMAX]);
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment