- 1of 1 vote
You are given a set of boxes b1 to bn. Each box bj has an associated width wj ,- sacboy September 04, 2011
height hj and depth dj . Give an algorithm for creating the highest possible stack of boxes with the
constraint that if box bj is stacked on box bi, the 2D base of bi must be larger in both dimensions
than the base of bj . You can of course, rotate the boxes to decide which face is the base, but you
can use each box only once.
For example, given two boxes with h1 = 5;w1 = 5; d1 = 1 and h2 = 4;w2 = 5; h2 = 2, you should
orient box 1 so that it has a base of 5x5 and a height of 1 and stack box 2 on top of it oriented so
that it has a height of 5 for a total stack height of 6.
| Report Duplicate | Flag | PURGE
Open Chat in New Window