search
Log In
0 votes
889 views
If inorder traversing a tree results in E A C K F H D B G, the preorder traversal would
return
(a) FAEKCDBHG
(b) FAEKCDHGB
(c) EAFKHDCBG
(d) FEAKDCHBG
in DS 889 views
0

in this question i relate pre-order and post order

https://gateoverflow.in/2504/gate1994-8

after reading it, you may answer to this question ( i know this question relating pre-order and in-order ).

If you still didn't get it after reading the answer, then comment !

by the way, option B is the answer !!

0

@ shaik 

Why not option a is true . 

0
in the picture you took option b but not option a, right?
0
Yes, i.e why not option b ??
0
I also commented option b as answer !
0

@Shaik Masthan

why left and right both leaves are need t be grater than root in that GATE question?

I know some question need intution, but my logic saying, if they havenot mentioned any order, then the tree can be anything and there can be more than one tree , from which we can get that post order traversal

Isnot it?

0
Mam, comment on original question..

It is not search tree ( i.e., left is less than root and right is grater than root ). It's just ternary tree
0

@Shaik Masthan

I mean these two also can be valid tree

Am I wrong?

if these diagram correct, then I add these diagram in main question too

 

0
Actually , logic always works right, than intution
0
those tree following post order but not preorder
0
mam, Note that, they defined pre-order also !
0

@Shaik Masthan

it is not BST. So, Preorder shouldnot always increasing order

0
they defined pre order is 1 to 12 in the order respectively.

moreover if it is even bst, we can't guarantee preorder is increasing sequence
0

moreover if it is even bst, we can't guarantee preorder is increasing sequence

yes, inorder sequence increasing order. I missed it.

 but they havenot mentioned the term "respectively"

they defined pre order is 1 to 12 in the order respectively.

0
even though they didn't mention the teem " respectively ", you can get it by the given statement lines.

Please log in or register to answer this question.

Related questions

2 votes
2 answers
3
3.7k views
how to convert into inorder traversal if preorder traversal of binary tree is given in the problem ? exaplain using example.
asked Jun 15, 2015 in DS anurag_am 3.7k views
1 vote
2 answers
4
7.7k views
When inorder traversing a tree resulted in EACKFHDBG; the preorder traversal would return— (A) FAEKCDBHG (B) FAEKCDHGB (C) EAFKHDCBG (D) FEAKDCHBG
asked Oct 20, 2017 in Programming Sanjay Sharma 7.7k views
...