title: Binary Search Tree Insert Implementation
body: <p>So my question is as follows:
  When I run the code for this insert helper method, and I am positive my new node method is correct as it works for instantiating a Binary Search Tree, no nodes are inserted. Why can't I use this certain implementation? What's going wrong here? </p>
  
  <p>I know how to use the other insert implementation where one would check for the left and right nodes of the root and whether or not they are null, but can not figure out the problem of this more elegant possibility. The answer to this will help me in creating other functions that go beyond the scope of the insert function.</p>
  
  <p>btw yes I have another function calling this helper function</p>
  
  <p>Thanks!!!!!</p>
  
  <pre><code>//INSERT METHODS
  void BinarySearchTree::insert(int data, struct node* root) {
  //If root is null make new node there
  if (!root) {
      root = new node(data);
  
  }
  else if (root -&gt; data &gt; data) {
      insert(data, root -&gt; left);
  }
  else {
      insert(data, root -&gt; right);
  }
  </code></pre>
  
  <p>}</p>