why only Preorder and Postorder is not suffice.
consider Two Binary Tree

Root = A
Left Chid = B

Preorder: A,B
Postorder: B,A

and
Root = A
Right Child = B

Preorder: ,A,B
Postorder: B,A


for given preorder and postorder two different binary trees can be formed

Thanks
Pramod Negi


On Thu, Apr 8, 2010 at 10:53 PM, Himanshu Aggarwal
<lkml.himan...@gmail.com>wrote:

> For a binary tree , if we are given an inorder traversal and a
> preorder/postorder/level-order traversal, we can always reconstruct back the
> binary tree. This technique can be used to save and restore the binary tree
> efficiently.
>
> I have read that it is necessary to have an inorder traversal to
> reconstruct the tree. i.e. if we are given a preorder and a postorder
> traversal, the binary tree can not be reconstructed.
>
> Can someone help me in understanding why this is so? i.e. why is inorder
> traversal a mandatory requirement. Why can not we reconstruct the tree with
> a given preorder and a postorder
>
> Thanks to everyone for their suggestions and replies.
>
> ~Himanshu Aggarwal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to