Binary tree traversal
The first traversal order of the binary tree is: Father-> left son-> right son
The central traversal order is: Left son-> father-> right son
The descending order is as follows: Right son-> left son-> father
struct Node { int value; Node *left_child; Node *right_child; Node () { left_child = right_child = NULL; }};bool first = true;void Pre_order(Node *tree) { if(first) { cout << tree->value; first = false; } else cout << " " << tree->value; if(tree->left_child != NULL) { Pre_order(tree->left_child); } if(tree->right_child != NULL) { Pre_order(tree->right_child); }}void Mid_order(Node *tree) { if(tree->left_child != NULL) { Mid_order(tree->left_child); } if(first) { cout << tree->value; first = false; } else cout << " " << tree->value; if(tree->right_child != NULL) { Mid_order(tree->right_child); }}void Pos_order(Node *tree) { if(tree->left_child != NULL) { Pos_order(tree->left_child); } if(tree->right_child != NULL) { Pos_order(tree->right_child); } if(first) { cout << tree->value; first = false; } else cout << " " << tree->value;}