title: C++ Binary Search Tree Insertion functions
body: <p>Helly everyone,</p>
  
  <p>I took a C++ coding course with practically no prior knowledge(my understanding of pointers is still somewhat shakey)at University this semester.
  I have to implement a binary search tree in C++ and my problem is as follows:
  Over a predefined Node structure with values and pointers to a left and a right node I am supposed to implement several functions, two of them being:</p>
  
  <pre><code>void InsertNode(Node* root, Node* node)
  </code></pre>
  
  <p>which is supposed to fit the handed node into the given tree "root",
  and another one called</p>
  
  <pre><code>void InsertValue(Node* root, int value)
  </code></pre>
  
  <p>which should create a new instance of the node struct with the passed value and fit it in the given tree "root". To do so I am supposed to use both CreateNode (simple function to create Node* pointer of a new Node instance with int value and left/right pointers set to NULL) and InsertNode.</p>
  
  <p>Im kind of running in a treadmill here and i dont think i really understand how the functions are supposed to work(eg. the difference between them).
  Yesterday i wrote this function:</p>
  
  <pre><code>void InsertNode(Node* root, Node* node){
      if(root == NULL){
          root = CreateNode(node-&gt;value);
      }
      else if(root-&gt;value &lt; node-&gt;value){
          if(node-&gt;left != NULL){
               InsertNode(root, node-&gt;left);
          }
          else{
               node-&gt;left = CreateNode(root-&gt;value);
          }
      }
      else if(root-&gt;value &gt; node-&gt;value){
          if(node-&gt;right != NULL){
               InsertNode(root, node-&gt;right);
          }
          else{
              node-&gt;right = CreateNode(root-&gt;value);
          }
      }
  }
  </code></pre>
  
  <p>Since im not really able to test these functions without the later functions that will actually build the tree with given nodes i was curious if i could get some help here with the next functions InsertValue(what is it supposed to do that InsertNode doesnt do already? :S)</p>
  
  <p>Greetings and thanks in advance.</p>