Insert to Binary Tree

  1. Let's design a structure
    
    struct Node
    {
        int value;
        Node* pLeft;
        Node* pRight;
    };
    
    
  2. Design a function insertToTree(), which will recursively insert smaller value in its left sub-tree, and larger (or equal) values in its right sub-tree.
  3. Design a function printTree(p), which recursively prints
    1. its left subtree,
    2. its value, and
    3. its right subtree.
  4. The results will be a sorted sequence.

The program may run as follows:

9 8 7 5 3 2 0
2 3 5 7 8 9