I know one cannot construct a tree without having both Inorder and Preorder/postorder traversals. Because for a given (only Inorder/Preorder/postorder) there could be a possibility of generating more number of trees. Are there any algorithms or mechanism one can compute the number of unique trees from a given (only Inorder/Preorder/postorder traversal).
Eg : a b c d e f g this is my Inorder traversal.
How many unique trees that can be constructed with the given Inorder traversal.
I tried them is google but none of the explanations are clear
Any help would be appreciated...
one cannot construct a tree without having both Inorder and Preorder/postorder traversals
that is one bold statement: Given keys unique in the subtree they root in preorder (equivalently postorder) and information about their sequence from left to right (explicitly or by order (search tree)), one can unambiguously reconstruct a tree. (Come to think of it, this seems to need a restriction to binary tree (implied with inorder).) – greybeard