Hey guys. I have a project due in 2 weeks, so I have a little bit of time - but I have a lot of work to do, so I want to get this finished. I'm taking a C++ Data Structures class at my high school.. and we have a project that I am stuck on.

It's using Binary Search Trees. I need to input 10 values into the tree, do traversals through the tree (inorder, preorder, and postorder) then indicate which level each node is on. I got all of the traversals down, i can indicate how many leaf nodes there are, nodes with 1 children, and nodes with 2 children - however I don't know what how to figure out the level. I'm new to programming in C++, so this may be an easy question that I should be able to figure out. I'm guessing that I should initialize level to -1 (since the level would be base 0), then increment it every time a node is inserted. The thing is, there can be more than one node on each level, so I'm a little confused. Can anyone help? I just need a little hint to get me started.

Thanks so much.

9 Years
Discussion Span
Last Post by vijayan121
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.