title: Binary tree: method remove subtree
body: <p>I had an unordered Binary tree and I had to do a method that remove the subtree of root x. If the element x is present several times in the binary tree, the method remove only one of the subtree of root x (the first it finds). If the deletion was performed, returns true. If the element x is not present in the binary tree, returns false. So the method is:</p>
  
  <pre><code>    public class BinaryTree 
  {
      protected class Node 
      {
          Integer element;
          Node left;
          Node right;
  
          Node(int element) 
          {
              this.element = element;
              left = right = null;
          }
  
          Node(int element, Node left, Node right) 
          {
              this.element = element;
              this.left = left;
              this.right = right;
          }
  
      protected Node root;
  
      public BinaryTree() 
      {
          root = null;
      }
  
      private class BoolNode 
      {
          boolean ft;
          Node nodo;
  
          BoolNode(boolean ft, Node nodo) 
          {
              this.ft = ft;
              this.nodo = nodo;
          }
      }
  
      public boolean removeSubtree(int x) 
      {
          BoolNode ris = removeSubtree(x, root);
          //root = ...;
          return ris.ft;
      }
  
      private BoolNode removeSubtree(int x, Node node) 
      {
          return null;
      }
  }
  </code></pre>
  
  <p>I do not know how to start, does anyone have any idea? Even pseudocode..
  Thanks!</p>