NO with only preorder and post order given we cant find a unique tree....
either preorder with inorder or postorder with inorder is required for "unique" tree..
we have 2nCn/(n+1) binary trees with n nodes(unlabelled).....and we can get a pre order for each one of them.....and if we try to find post order then definitly we will get more than 1 tree satisfying both conditions together
we need inorder also....either we use inorder with pre or post we will get unique tree each time....but it is neccessary to have inorder..because then only 1 tree can satisfy these conditions
let me give an example with 3 nodes..u can generalise it afterwards
say we have three nodes...even if labelled we get 5 binary trees and every binary tree can be a preorder....
preorder ABC..we get 5 trees..
suppose we want post order CBA....u will see we will get 4 out of those 5 trees satisfying both preorder and post order simultaneously
so UNIQUE TREE not possible with only pre and post order given
try to apply inorder condition sayBCA...
only one out of those 4 trees will satisfy all of them together..