In this exercice, you have to write a function which will travel a tree tree_t
according to an inorder tour.
As a reminder, an inorder tour visits the nodes in this order:
- The left sub-tree
- The actual node
- The right sub-tree
The structure tree_t
is defined as below:
typedef struct tree{ int value; // the value at root of this tree int number_elements; // number of elements in the tree // bellow this root (including self) struct tree *left; // left sub-tree struct tree *right; // right sub-tree }tree_t; /** * 1 * / \ * 0 2 * / * -1 * * => tree(1).number_elements = 4 because it has 3 childs + himself */