title: Binary tree Delete by merge recursive implementation
body: <p>I have implemented the iterative version of delete by merge but I'm struggling to implemented recursively.</p>
  
  <p>This is my iterative version:</p>
  
  <pre><code>public void deleteByMerging(T el) {
      BSTNode&lt;T&gt; tmp, node, p = root, prev = null;
      while (p != null &amp;&amp; !p.el.equals(el)) {  
           prev = p;                           
           if (el.compareTo(p.el) &lt; 0)
                p = p.right;
           else p = p.left;
      }
      node = p;
      if (p != null &amp;&amp; p.el.equals(el)) {
           if (node.right == null) 
                node = node.left;  
           else if (node.left == null) 
                node = node.right; 
           else {                  
                tmp = node.left;   
                while (tmp.right != null) 
                    tmp = tmp.right;      
                tmp.right =        
                    node.right;    
  
                node = node.left;  
           }
           if (p == root)
                root = node;
           else if (prev.left == p)
                prev.left = node;
           else prev.right = node; // 5.
      }
      else if (root != null)
           System.out.println("el " + el + " is not in the tree");
      else System.out.println("the tree is empty");
  }
  </code></pre>
  
  <p>Now I need to implement the recursive function in this way:</p>
  
  <pre><code>public void delete(T info) {
      root = delete(root, info);
  }
  
  public TreeNode&lt;T&gt; delete(TreeNode&lt;T&gt; node, T info) 
      {
  
      }
  </code></pre>
  
  <p>Im very new with recursion and I have no idea of where to start.</p>