Hi if someone can help me it would be great!!! Basically I have a remove method which removes a specified node but what the method is doing is deleting the entire tree. I tried debugging but I cant see the problem.
Here is my code...
You say you tried debugging your code, but I don't see any println() calls that would be useful for that. Your first step should be to add a bunch to the remove method, to show what's happening at each step, what it's removing, and what the tree looks like before and after.
You are assigning head.right = tail in your remove routine and when it goes to traverse() there is nothing to traverse. You are making t = tail on line 113. You essential disconnected the whole tree as far as traverse() is concerned. I think you need to start over on your removal routine and think through what you need to do step by step and write it down in pseudo code before you code it. Other than that, there are probably hundreds of examples on the Internet of binary tree operations you should look at.
Post by:autobot
It's feeding time! Give me the food you were going to give to this tiny ad:
a bit of art, as a gift, the permaculture playing cards