diff --git a/main_compress.c b/main_compress.c index bef372f..7ba1108 100644 --- a/main_compress.c +++ b/main_compress.c @@ -2,7 +2,7 @@ #include "arbre_de_codage/arbre_binaire.c" #define ASCII_EXT 256 -arbre huffman(arbre T[]); +void huffman(arbre T[], int n); void frequence(arbre T[], FILE *file); void tri_tab(arbre T[],int n); void afficher_tab(arbre T[], int n); @@ -44,13 +44,8 @@ int main(int argc, char **argv){ void init_tab(arbre T[], int n){ int i; - arbre tmp; - tmp->elt=0; - tmp->fils_droit=NULL; - tmp->fils_gauche=NULL; - tmp->poids=-1; for(i=0;ipoids==-1){ i++; } - int Index; - Index=i; - while(Index<255){ - arbre tmp=malloc(sizeof(noeud*)); - tmp->fils_gauche=T[Index]; - tmp->fils_droit=T[Index+1]; - T[Index+1]=tmp; - Index++; - tri_tab(T,ASCII_EXT); + // récupérer les deux plus petits poids (cf : deux premieres occurences) + if(compteur_tab(T,ASCII_EXT)!=1){ + arbre tmp=creer_feuille(-,T); + } - return T[Index]; -} - /* - while(compteur_tab(T,ASCII_EXT)>1){ - // Récupération des plus faibles poids - int i; - i=0; - while(T[i]->poids!=-1){ - i++; - } - int Index; - Index=i; - - } -} -*/ \ No newline at end of file +} \ No newline at end of file