Any particulary reason you're writing procedural code in C++? A better approach would be to create a tree class that handles everything.
Anyways, one major problem you have is that you pass a single pointer to traverse. The pointer in traverse is local to the function, so setting
current = new node;
Only modifies the pointer in the function.
Have you been reading a tutorial on binary trees? If you have, I think you should re-read it, and possibly find one that is specifically object oriented.
Last edited by GloriousEremite; Oct 2nd, 2006 at 12:52 am.
Reputation Points: 108
Solved Threads: 14
Junior Poster in Training
Offline 65 posts
since Jul 2006