in DS recategorized by
521 views
0 votes
0 votes
pre order :13245786

in order : 12345678
in DS recategorized by
521 views

2 Comments

Here one of them is wrong slightly last three nodes.
If i draw binary tree considering preorder as correct then inorder should be12345876 or vice versa
0
0
yes , i also think this can`t be drawn .

last 3 nodes are the main culpits :D

thanx for conformation .
0
0

1 Answer

0 votes
0 votes

Pre-order : Root - Left Child - Right Child
In-order : Left Child - Root - Right Child

pre order :13245786
in order : 12345678

1.Pre-order first element will be root node. 
      make the node of tree.
2.Now scan that node in in-order to its left will be its left child to its right it will be right child
3.Repeat step 1.  

Here 1.1 is root node of tree and it has no left child.
       2.Now next node will be 3 to right of 1 and
                3 right child is 2 and left child are 45678 
 Similarly make the tree.

2 Comments

so you are saying it is possible to form this tree with the give in and pre order . r8 ??
0
0
Not happening!!
Do you find any specific reason for that?
or this statement is false " From given pre-order/post-order and in-order a unique binary tree is possible."
0
0

Related questions

0 votes
0 votes
1 answer
1