If it is a BST...then having a pre-order traversal can give us the unique
binary tree.

Also, as per the problem statement,
> every node can have 0 or at most 2 nodes.

that means every node can have 0 or two childs, which is not the case below.

On Fri, Jan 14, 2011 at 6:49 PM, Balaji Ramani <rbalaji.psgt...@gmail.com>wrote:

> Two different binary trees can have same set of Leaves/Inner Nodes and same
> Preorder traversal
>
>                5
>             /     \
>           3      10
>         /   \
>        1   9
>               \
>               7
>
>
>               5
>             /   \
>           3     9
>         /       /  \
>       1       7   10
>
> So, I guess it is not solvable unless we have some more information.
>
> Thanks,
> Balaji.
>
> On Fri, Jan 14, 2011 at 10:50 AM, Decipher <ankurseth...@gmail.com> wrote:
>
>> A special type of tree is given, where all leaf are marked with L and
>> others are marked with N. every node can have 0 or at most 2 nodes. Trees
>> preorder traversal is given give a algorithm to build tree from this
>> traversal.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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 algogeeks@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 algogeeks@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