diff --git a/arbre_de_codage/arbre_binaire.c b/arbre_de_codage/arbre_binaire.c index 13ecb04..bf0df88 100644 --- a/arbre_de_codage/arbre_binaire.c +++ b/arbre_de_codage/arbre_binaire.c @@ -3,7 +3,9 @@ #include #include #include "arbre_binaire.h" - +#ifdef DEBUG +#define DEBUG 1 +#endif arbre creer_arbre_vide (void) { return NULL ; @@ -70,8 +72,23 @@ void free_arbre(arbre a) } void arbre_rechercher(arbre a, Elt c, char s[], int s_len, int found[]){ + /* + De ce que j'ai testé, ça marche de temps en temps même en ne changeant pas le caractère recherché, je pense qu'il y a un problème avec VSCode encore une fois LOL (Yûki) + */ + #ifdef DEBUG + printf("\nDEBUG ARBRE RECHERCHER : \n"); + printf(" est_arbre_vide(a) : %d\n",est_arbre_vide(a)); + printf(" est_feuille(a) : %d\n",est_feuille(a)); + printf(" racine(a) : %c\n",racine(a)); + printf(" c : %c\n",c); + printf(" est_arbre_vide(fils_gauche(a)) : %d\n",est_arbre_vide(fils_gauche(a))); + printf(" est_arbre_vide(fils_droit(a)) : %d\n",est_arbre_vide(fils_droit(a))); + printf(" S : %s\n",s); + printf("--FIN DEBUG ARBRE RECHERCHER--\n"); + #endif + if(!est_arbre_vide(a)){ - if(est_feuille(a)&&racine(a)==c){ + if((a->fils_gauche==NULL&&a->fils_droit==NULL)&&racine(a)==c){ found[0]=1; return ; } @@ -83,5 +100,6 @@ void arbre_rechercher(arbre a, Elt c, char s[], int s_len, int found[]){ s[s_len]='1'; arbre_rechercher(fils_droit(a),c,s,s_len+1,found); } + } } \ No newline at end of file diff --git a/gestion_des_fichiers/test.txt b/gestion_des_fichiers/test.txt index a3b5af6..5ebc423 100644 --- a/gestion_des_fichiers/test.txt +++ b/gestion_des_fichiers/test.txt @@ -1 +1 @@ -Ceci est un test. \ No newline at end of file +mon code C est le meilleure : int myfunction(arbre ahah){printf("coucou");pointeur->quipointe;} \ No newline at end of file diff --git a/main_compress.c b/main_compress.c index e5ff134..ebf7810 100644 --- a/main_compress.c +++ b/main_compress.c @@ -41,9 +41,9 @@ int main(int argc, char **argv){ // Récupération du code de chaque charactere printf("Code : \n"); - char s[8]="2"; + char s[80]=""; int f[1]={0}; - char search=' '; + char search='-'; arbre_rechercher(huff,search,s,0,f); if(f[0]==1){ printf("\nTrouve : %s\n",s);