C'est mieux.

master
Yann CHAMPEAU 3 years ago
parent 25d4cbe9ce
commit fdcfdf3ff6

@ -101,12 +101,10 @@ int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){
return -1; return -1;
} }
int* tabcpy(int tab[], int tlogi){ void tabcpy(int tabS[], int tabD[], int tlogi){
int ret[tlogi];
for(int i=0; i<tlogi; i++){ for(int i=0; i<tlogi; i++){
ret[i]=tab[i]; tabD[i]=tabS[i];
} }
return ret;
} }
//Listes chainées //Listes chainées

@ -257,17 +257,17 @@ int* fusion(tabG,tailleG,tabNoteG,tabD,tailleD,tabNoteD,retNote){
int* tri_fusion_rec(int tabIDCandidatAttente[], int tabNote[], int taille){ int* tri_fusion_rec(int tabIDCandidatAttente[], int tabNote[], int taille){
if(taille==1) return tabIDCandidatAttente; if(taille==1) return tabIDCandidatAttente;
int tabNoteG[taille/2], tabNoteD[taille-taille/2], retNote[taille]; int tabNoteG[taille/2], tabNoteD[taille-taille/2], retNote[taille];
tabNoteG=tabcpy(tabNote,taille/2); tabcpy(tabNote,tabNoteG,taille/2);
tabNoteD=tabcpy(tabNote+taille/2,taille); tabcpy(tabNote+taille/2,tabNoteD,taille);
int ret[taille]; int ret[taille];
ret=fusion(tri_fusion_rec(tabIDCandidatAttente,tabNoteG,taille/2),taille/2,tabNoteG,\ ret=fusion(tri_fusion_rec(tabIDCandidatAttente,tabNoteG,taille/2),taille/2,tabNoteG,\
tri_fusion_rec(tabIDCandidatAttente+taille/2,tabNoteD,taille-taille/2),taille-taille/2,tabNoteD,retNote); tri_fusion_rec(tabIDCandidatAttente+taille/2,tabNoteD,taille-taille/2),taille-taille/2,tabNoteD,retNote);
tabNote=tabcpy(retNote,taille); tabcpy(retNote,tabNote,taille);
return ret; return ret;
} }
int* tri_fusion(int tabIDCandidatAttente[], int tabNote[], int taille){ int* tri_fusion(int tabIDCandidatAttente[], int tabNote[], int taille){
int notes[taille]; int notes[taille];
notes=tabcpy(tabNote,taille); tabcpy(tabNote,notes,taille);
return tri_fusion_rec(tabIDCandidatAttente,notes,taille); return tri_fusion_rec(tabIDCandidatAttente,notes,taille);
}*/ }*/
Loading…
Cancel
Save