title: Java, Binary tree remove method
body: <p>I am trying to write a <code>remove(node cRoot, Object o)</code> function for a sorted binary tree.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>private boolean remove(Node cRoot, Object o) {
    if (cRoot == null) {
      return false;
    }
    else if (cRoot.item.equals(o)) { 
      //erase node fix tree
      return true;
    }
    else if (((Comparable)item).compareTo(cRoot.item)&lt;=0){
      return remove(cRoot.lChild, o);
    }
    else { 
       return remove(cRoot.rChild,o);
    }
  }
  </code></pre>
  
  <p>It does not work correctly.  To delete a node you have to repair the tree to fix the hole.  How should this be done?</p>