Skip to content
Snippets Groups Projects
Commit 40a47028 authored by Nikolic's avatar Nikolic
Browse files

Ajout d'une fonction permettant de parcourir un arbre de manière infixe

parent 12c7cc7e
Branches
No related tags found
No related merge requests found
...@@ -17,3 +17,15 @@ tree nextRight(node * node){ ...@@ -17,3 +17,15 @@ tree nextRight(node * node){
void nood_print(node * data){ void nood_print(node * data){
} }
void parcours_infix(node * node, int n){
if (NULL != node) {
parcours_infix(nextLeft(node), n+1);
for (int i = 0; i < n; i++) {
printf(" ");
}
nood_print(node);
parcours_infix(nextRight(node), n+1);
}
}
\ No newline at end of file
...@@ -29,3 +29,9 @@ tree nextRight(node * node); ...@@ -29,3 +29,9 @@ tree nextRight(node * node);
* Function permettant d'afficher un l'arbre * Function permettant d'afficher un l'arbre
*/ */
void nood_print(node * data); void nood_print(node * data);
/*
* Function permettant d'effectuer un parcours d'ordre infixe (GRD)
*/
void parcours_infix(node * node, int n);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment