public void remove( AnyType x )
{ root = remove(
x, root ); }
so that it doesn't use the recursive method:
private BinaryNode<AnyType> remove( AnyType x, BinaryNode<AnyType> t ) { .... }
Instead, it should a while-loop to search for the element (don't use the recursive find method) and then delete it properly. Note that there should be no use of recursion in this public method.
Starting from the ROOT;
While ( the node is not null AND the node doesn't contain the element x ){
go to its left or right child accordingly;
}
if the node is null then x is not found; //there is nothing to delete
else //the node contains x
handle the 3 cases separately; i.e., the node has no children or one
child or two children;