I have a Find function in order to find an element from a BST
private Node Find(ref Node n, int e)
{
if (n == null)
return null;
if (n.Element == e)
return n;
if (e > n.Element)
return Find(ref n.Right, e);
else
return Find(ref n.Left, e);
}
and I use following code in order to get a node and then set this node to null.
Node x = bsTree.Find(1);
x = null;
bsTree.Print();
supposedly, this node should be deleted from Tree as it is set to null but it still exists in tree.
I had done this before but this time missing something and no idea what.