Sep 9, 2012 at 3:32pm UTC
Draw binary search tree, which in inorder traversal gives the following sequence of numbers -> 1, 6, 3, 2, 5, 4, 8, 7, 9
thanks
Sep 9, 2012 at 3:36pm UTC
No. I think they mean you should do it.
Sep 9, 2012 at 3:36pm UTC
So...what's the problem ?
Sep 9, 2012 at 3:41pm UTC
We do not do h/w, show us your code, tell us whats wrong, and we can see if we can help you.
Sep 9, 2012 at 3:46pm UTC
I do not need your code i just need to draw that tree in inorder traversal
...........5........
....6..........8..
..1...3... 7...9...
......2....
Is that right ?
Sep 9, 2012 at 3:55pm UTC
It is almost correct. The order of the numbers after 5 is not correct and you forgot 4.
Sep 9, 2012 at 4:01pm UTC
Do you have any suggestion for me for how to do it??
Sep 9, 2012 at 4:07pm UTC
You manage to do most of it so I don't think the rest should be a problem. Look at the right subtree of 5. Note that there are many possible solutions.
Sep 9, 2012 at 4:17pm UTC
In inorder traversal, always check if there are any child nodes on left hand side, then the root node comes. So if you get 3,6 instead of 6,3 (just a random example) while traversing you can change the positions of 6 and 3.
Last edited on Sep 9, 2012 at 4:18pm UTC
Sep 9, 2012 at 5:02pm UTC
So can anyone of you guys show me how you would construct this binary tree because im prety confused
Sep 9, 2012 at 5:05pm UTC
@magicalLeno
Do you understand what "inorder traversal" means?
Sep 9, 2012 at 5:11pm UTC
Not completely, can you please enlighten me