Serving the Quantitative Finance Community

 
User avatar
achele
Topic Author
Posts: 0
Joined: July 6th, 2008, 12:04 am

Boxes Into Boxes [Algorithm]

May 28th, 2009, 9:07 pm

I was reminded of this problem by the problem here (http://www.wilmott.com/messageview.cfm? ... adid=70684) but this is more of a theoretical computer science/algorithms question...You have n boxes that are taking too much space in your garage, and you want to consolidate them to reduce space. Your plan is to produce groups of boxes by placing boxes inside of each other. A box can have at most one box immediately inside of it, and a box by itself is still considered a group. You want to nest the boxes in such a way that minimizes the number of groups created. Find an efficient algorithm that determines how you should group the boxes.
 
User avatar
trippel
Posts: 0
Joined: May 27th, 2009, 11:17 am

Boxes Into Boxes [Algorithm]

May 29th, 2009, 7:36 am

Your description is quite unspecific. You do not state what the sizes of the boxes are (real numbers, are there any restrictions, ...). If you are interested in stuff like that and practice algorithm traning, go for www.spoj.pl. It is a good Online Judge, accepting major programming languages. You will finde similar task there!
 
User avatar
achele
Topic Author
Posts: 0
Joined: July 6th, 2008, 12:04 am

Boxes Into Boxes [Algorithm]

May 30th, 2009, 5:59 am

You can determine whether one box can fit in another in constant time. That's all you really need to know to to solve the problem in polynomial time. It's meant to be open ended, though there is a particularly efficient method for solving the problem.
Last edited by achele on May 29th, 2009, 10:00 pm, edited 1 time in total.
 
User avatar
ghan
Posts: 0
Joined: November 9th, 2005, 12:36 pm

Boxes Into Boxes [Algorithm]

June 2nd, 2009, 1:25 pm

It seems that it can be done in O(n^2) time.