• recategorized
5,828 views
1 1 vote

Consider the In-order and Post-order traversals of a tree as given below:

In-order: j e n k o p b f a c l g m d h i

Post-order: j n o p k e f b c l m g h I d a

The Pre-order traversal of the tree shall be

  1. a b f e j k n o p c d g l m h i
  2. a b c d e f j k n o p g l m h i
  3. a b e j k n o p f c d g l m h i
  4. j e n o p k f b c l m g h I d a

1 Answer

3 3 votes

If we consider given In-order and Post Order and construct the tree then no option is going to match .

                  

This is the tree with given in-order  and post-order

If you traverse it from top to bottom left to right and print each element second time then we are going to get the exact in-order given in question .

if we print the element last time then we are going to get the post-order. But for pre-order it does not give us any option from given options, So correct pre-order should be 

Preorder : abejknpofdglcmih

Answer:
Position:
Show:

Related questions

1 1 vote
1 answers 1 answer
4.7k
4.7k views
shivani2010 asked Jun 9, 2016
4,746 views
The min. number of nodes in a binary tree of depth d (root at level 0) is$(2^d + 1)$$(2^{(d+1)} - 1)$$d$$d + 1$
2 2 votes
2 2 answers
5.3k
5.3k views
go_editor asked Jul 20, 2016
5,315 views
The efficient data structure to insert/delete a number in a stored set of number isQueueLinked listDoubly linked listBinary tree
5 5 votes
1 1 answer
8.5k
8.5k views
go_editor asked Jul 20, 2016
8,517 views
Suppose that the splits at every level of Quicksort are in proportion $1-\beta \text{ to } \beta$, where $0 < \beta \leq 0.5$ is a constant. The number of elements in an ...
4 4 votes
1 answers 1 answer
4.5k
4.5k views
shivani2010 asked Jun 9, 2016
4,468 views
Consider the following statements:A graph in which there is a unique path between every pair of vertices is a tree.A connected graph with e=v-1 is a treeA connected graph...