title: Recursive Binary Search Tree Insert
body: <p>So this is my first java program, but I've done c++ for a few years. I wrote what I think should work, but in fact it does not. So I had a stipulation of having to write a method for this call:</p>
  
  <pre><code>tree.insertNode(value);
  </code></pre>
  
  <p>where value is an int.
  I wanted to write it recursively, for obvious reasons, so I had to do a work around:</p>
  
  <pre><code>public void insertNode(int key) {
      Node temp = new Node(key);
  
      if(root == null) root = temp;
  
      else insertNode(temp);
  }
  
  public void insertNode(Node temp) {
      if(root == null)
          root = temp;
  
      else if(temp.getKey() &lt;= root.getKey())
          insertNode(root.getLeft());
  
      else insertNode(root.getRight());
  }
  </code></pre>
  
  <p>Thanks for any advice.</p>