#include #include typedef struct noeud { int valeur; struct noeud *gauche; struct noeud *droite; } noeud ; void print_arbre(noeud *arbre) { if (arbre==NULL) printf("NULL\n"); else if(arbre!=NULL) { printf("%d\n",arbre->valeur); if (arbre->gauche != NULL) print_arbre(arbre->gauche); // printf("\n");} else if(arbre->gauche == NULL) printf("NULL\t"); if (arbre->droite != NULL) print_arbre(arbre->droite); // printf("\n");} else if (arbre->droite != NULL) printf("NULL\t"); } } void insertion(noeud ** arbre, int v){ if (*arbre==NULL) /* si le noeud n’existe pas, on le crée */ { *arbre=(noeud*) malloc(sizeof(noeud)); (*arbre)->valeur=v; (*arbre)->gauche=NULL; (*arbre)->droite=NULL; } } // else // { // if (v>(*arbre)->valeur) void insertionD(noeud ** arbre, int v){ insertion(&(*arbre)->droite,v); /* aller a droite */ } // else void insertionG(noeud ** arbre, int v){ insertion(&(*arbre)->gauche,v); /* aller a gauche */ } int main(){ noeud *Arbre = NULL; insertion(&Arbre, 303); insertionD(&Arbre, 304); insertionG(&Arbre, 305); print_arbre(Arbre); // FILE* fichier = NULL; //fichier = fopen("texte.txt","r"); return 0; }