Obviously, it would be a lot easier to look at this if you had posted all the code.
However: Find_Trav_Subtree looks very strange [to me].
You see it calls the right branch if (current->Right) AND thenalways returns Find_Trav_Subtree from the right branch REGARDSLESS of it returning a NULL. I would have expected to see something like this:
BSTNodePtr Result(0);
// Note only return from right if a valid result is found:
if ( Current->Right && (Result = Find_Trav_SubTree(Current->Right,ID)) )
return Result;
return ( Current->Left) ? Find_Trav_SubTree(Current->Left,ID) : 0;
There are many ways to do this.
Hope that helps, if not please post the full BSTClass so we can also compile and debug it.
StuXYZ
Practically a Master Poster
680 posts since Nov 2008
Reputation Points: 760
Solved Threads: 138