edited by
2,350 views
1 votes
1 votes
assume the preorder tŕaversal of binary tree is "abc" how many total different binary trees are possible whose postorder traversal.is "cba" with the given preorder traversal.??

how to find it ?
edited by

2 Answers

2 votes
2 votes

Simple way is, in question clearly say that Preorder is "abc" and Postorder is "cba", that means root element is 'a' and leaf element is 'c'.

So that, we can design 4 binary trees with the help of remaining element i.e., 'b'.

'b' can be left child of 'a' and/or right child, similalry 'c' can be left child of 'b' and/or right child.

total 4 combination.

Related questions

2 votes
2 votes
5 answers
2
Hardik Vagadia asked Nov 13, 2017
886 views
A 4-ary tree,i.e. each node has either 0 or 4 children tree has 20 leaf nodes. Then the total number of nodes in the tree are ____.
1 votes
1 votes
1 answer
3