if preorder is given ,how can we know that a unique tree is forming ,it might be the case that multiple trees have same preorder traversal?
explain to me how and in which cases a unique tree exist
If preorder is given ,how can we know that a unique tree is forming ,it might be the case that multiple trees have same preorder traversal
hey @shakul if only preorder or only postorder or only inorder is given, there can be multiple trees i.e. no unique tree.
You can build a unique tree only when preorder and inorder traversal is given or postorder and inorder traversal is given.