Les arbres
salut, donne mois un programme principale pour testé cette fonction (ABR):
struct Noeud
{
int valeur;
struct Noeud *gauche;
struct Noeud *droite;
};
struct Noeud *arbre;
struct Noeud *recherche(struct Noeud *racine,int x)
{
if(racine->valeur==x) return racine;
if(x <= racine->valeur)
{
if(racine->gauche != NULL)
return recherche(racine->gauche,x);
else return NULL;
}
else
{if(racine->droite != NULL)
return recherche(racine->droite,x);
else
return NULL;
}
}
struct Noeud
{
int valeur;
struct Noeud *gauche;
struct Noeud *droite;
};
struct Noeud *arbre;
struct Noeud *recherche(struct Noeud *racine,int x)
{
if(racine->valeur==x) return racine;
if(x <= racine->valeur)
{
if(racine->gauche != NULL)
return recherche(racine->gauche,x);
else return NULL;
}
else
{if(racine->droite != NULL)
return recherche(racine->droite,x);
else
return NULL;
}
}