# recriating a bst tree from preorder

This is a discussion on recriating a bst tree from preorder within the C Programming forums, part of the General Programming Boards category; i have an array of the pre order traversal and i know that the root it arr[0] and its left ...

1. ## recriating a bst tree from preorder

i have an array of the pre order traversal
and i know that the root it arr[0]
and its left son is arr[1]

whats the formula for spotting the value of its right son value

??

2. Given, node with index i and it's left child is 2i. Working out what the right child is shouldn't be too hard for you.

Hint: Draw the tree and its array.

3. its not 2i but i+1

i got to that conclution too

but the right son is hard
because if a tree is not simetric and somewhere we dont have a left of right node
then we cant break it into two

4. i think the answer is searching the first node whoch is larger then arr[i]

is it ok?

5. Just use a value that wasn't in the tree before you flattened it as nil.