No it doesn't. For example lets take this order:
 If Box 1 has LBH as 5 8 7
If Box 2 has LBH as 5 6 8
If Box 3 has LBH as 4 4 4
If Box 4 has LBH as 7 8 9

Box 1 dim: 5,8,7. It becomes root1. count1=1.
Box2 dim: 5,6,8 cannot be made part of root1. So it becomes root2. count2=1
Box 3 dim: 4,4,4. It can be made as the left child of both root1 and root2.
count1=2 count2=2
Box 4 dim: 7,8,9. It cannot be made part of the first tree, so root2->right
will be box4. count2=3.
As count2>count1, print the reverse inorder traversal of tree2

output will be:
4,2,3

On Wed, Jun 23, 2010 at 9:33 PM, Bhanu Pratap Singh <[email protected]
> wrote:

> Hi Raj,
>
> What if the boxes are given in some different order. The solution given
> depends very much on the order in which boxes are given.
>
>
> On Wed, Jun 23, 2010 at 2:10 PM, Raj N <[email protected]> wrote:
>
>> Given a lot of cuboid boxes with different length, breadth and height.
>> We need to find the maximum subset which can fit into each other.
>>
>> For example:
>> If Box 1 has LBH as 7 8 9
>> If Box 2 has LBH as 5 6 8
>> If Box 3 has LBH as 5 8 7
>> If Box 4 has LBH as 4 4 4
>>
>> then answer is 1,2,4
>>
>> A box can fit into another only and only if all dimensions of that is
>> less than the bigger box.Rotation of boxes is not possible.
>>
>> My approach:
>>
>> Constructing trees...
>> Box 1 dim: 7,8,9 Make it as root1. The root also has a counter
>> associated with it. Now count1=1.
>> Then Box 2 dim: 5,6,8 < 7,8,9. Make it as a left child of root1 and
>> count1=2.
>> Box 3 dim: 5,8,7 doesn't fit in any and hence make it a tree by itself
>> i.e root2 its count2=1.
>> Box 4 dim: 4,4,4 it can be made as the left child of box 2 as well as
>> Box 3.
>> count1=3, count2=2.
>> Print the reverse inorder traversal of the highest counter valued
>> tree.
>>
>> Please correct me if I'm wrong.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<algogeeks%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Regards
> Bhanu
> Mobile   +91 9886738496
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to