Smallest packaging of rectangles

46 Views Asked by At

I'm trying to stack $n$ rectangles with size $a \times b$ to minimize the distance from the origin to the furthest point ($L$).

I attach a couple of images to clarify.

Image 1 Image 2

Thanks for you help!

Jorge

1

There are 1 best solutions below

0
On

A greedy algorithm will work.

It suffices to show that if we have two boxes stack on top of each other, the higher one will have a greater L. Hence we just maintain a priority queue of all the possible locations to put a box, then choose the one with the smallest L, place it and insert the new possible locations into the priority queue.