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 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