Partition a rectangle into near-squares of given areas
- by Marko Dumic
I have a set of N positive numbers, and a rectangle of dimensions X and Y that I need to partition it in N smaller rectangles such that:
the surface area of each smaller rectangle is proportional to it's corresponding number in given set
all space of big rectangle is occupied and there is no leftover space between smaller rectangles
each small rectangle should be shaped as close to square as feasible
the execution time should be reasonably small
I need directions on this. Do you know of such algorithm described on the web? Do you have any ideas (pseudo-code is fine)?
Thanks.