Can any one help me to solve this.
When inorder traversing a tree resulted E A C K F H D B G; the preorder and postorder traversal would return

C K F H D B G

Hey, do you have an image of what the tree actually looks like?

Thanks :)

no tree structure was provided for this...question was taken from placement papers

E A C K F H D B G

there can be a lot of ways for the elements to be created in an inorder traversal from a tree which makes a lot of possible preorder or postorder solution
is the root node/element given at least?

Inorder -> E is the root, I think.

The problem is when to move from innode to child nodes. I suspect that this is supposed to be balanced binary tree, but even that is not given by th poster. In that case A would be left child and H right child.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.