445 views
2 votes
2 votes
Given a tree of 3 nodes A,B and C, the Inorder Traversal is CAB and the Preorder Traversal is ABC. What is the structure of the tree?

1 Answer

Best answer
3 votes
3 votes
You do damage to property of preorder and inorder

preoder : Root Left Right

Inorder : Left Root Right

you gave

CAB as inorder means A is root then C is left and then B is right

So how in preorder how can  B be a left child.

So here you are take preorder of one tree and inorder of another tree. Hope u got it
selected by

Related questions

0 votes
0 votes
1 answer
1
1 votes
1 votes
2 answers
2
Jithin Jayan asked Jul 23, 2016
651 views
Given an unsorted Array of n elements and asked to find the Largest element of that array. Can we use Max-Heapify Procedure to find the Largest element in that array in O...
0 votes
0 votes
3 answers
3
Jithin Jayan asked Jul 13, 2016
490 views
Given only pre-order of a Binary Search Tree, Can we identify a Binary Search Tree Uniquely?