Campbell Ritchie wrote:Another suggestion:
Write down the structure of your tree with some likely values attached to each node. Remember there are bound to be nulls all over the place. You should now have a little diagram.
Remove one of the nodes. Start with a leaf and see how that alters the structure of the tree. Then remove a non‑leaf node and see how the tree alters. Convert the changes on the diagram into instructions for how to remove a node, and then convert that lot to code.
That's just it, I can't make any references to null values like if(such == null). I can't make a new tree and reinsert the values back into the tree in the delete method. This is why its bugging me, I already drew it up on paper a long time ago to see how I was gonna do it. The problem I am having is removing that leaf/tree. I can switch the key that needs to be removed with the left max or right min but when the method ends and I print the tree that left is now on the map twice. Its on there twice because its in the spot that needed to be removed which is fine, and its still in its original place. Like is there some type of command that deletes the tree leaf.?