Thread: Binaray search tree (reverse, postorder)

1. Binaray search tree (reverse, postorder)

We have the following sequence of numbers : 10, 2, 7, 6, 3, 8, 5, 18, 1 and 9

a.) Draw binary search tree, which originate, if numbers from sequence are inputed into empty binary search tree and write out sequence of numbers in reverse traversal of a tree
b.)Draw binary search tree, which originate, if numbers from sequence are inputed into empty binary search tree in reverse order and write out sequence of numbers in preorder traversal.

Thanks for you help guys

2. Are you required to implement a C program here, or is this just a matter of computer science?

Oh, and what have you tried?

3. I do not need any code i just need to draw binary search tree with this numbers but i do not know how to start

4. *Thread moved to General Discussions*

Originally Posted by amazineous
i just need to draw binary search tree with this numbers but i do not know how to start
Review your notes on binary search trees. In particular, try to construct the examples to get an understanding of what they are about.

5. Are there many possible solutions to this problem ? And how do i know which number is the root. Is it right if i order this numbers into ascending order first and than i construct a binary tree?

6. The way I read the question you should construct the binary search tree that would result from inserting the numbers in sequence into an empty tree. That is, start with an empty tree, then construct the tree you get by inserting the number 10. Then take that tree and construct the tree you get from inserting the number 2 and so on. More info on binary search tree: Binary search tree - Wikipedia, the free encyclopedia

7. So would anyone of you guys who knows how to construct this binary tree be so kind and show me because i got no clue how to start

8. Did you read Shakti's post?

If you use 10 as the root, do you know where 2 will go?