How to find a specific traversal in a binary tree if another traversal is given?

+1 vote
When the  in-order traversal is done on a binary tree it yields E A C K F H D B G; its pre-order traversal would return....

a) FAEKCDBHG b) FAEKCDHGB c) EAFKHDCBG d) FEAKDCHBG e) None of these
asked May 25, 2012 in Data Structures and Algorithms by GOPEKRIS9 (160 points)
  

Hi  Gopekris9,

Is it possible to get pre-order traversal of a tree if its in-order traversal is given? In the book the dicusssion is mainly on construction of a tree if its two traversals are given(out of which in-order is a must). I would really like to know the way to get pre-order or post-order if in-order is given.I was under assumption that unless preorder traversal is given, it is impossible to know the root node of the BT.

Thanks.

 

1 Answer

0 votes
 
Best answer

Please trees chapters of our book. We have discussed this with code and examples.

answered Oct 8, 2012 by CareerMonk (17,520 points)
Is it possible to get pre-order traversal of a tree if its in-order traversal is given? In the book the dicusssion is mainly on construction of a tree if its two traversals are given(out of which in-order is a must). I would really like to know the way to get pre-order or post-order if in-order is given.