Were you given the tree and need to come up with the sequence? If so, it depends because there are tow general approaches to a traversal sequence, depth-first traversal or breadth-first traversal. Is the approach you need to use specified?
posted 11 years ago
I'm given those numbers and I have to make a tree.
Given the numbers and asked to insert them into a binary tree that remains sorted as you insert it, that will be the final structure.
It just so happens that if you were asked to keep the tree balanced or to not worry about keeping it balanced it would end up in the same structure. If the numbers had been in a different order, and you were asked to rebalance the tree after each insert, it would be a bit more trouble to figure out.
Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);