# Thread: Sorting Into Groups Based On Arbitrary Size

1. ## Sorting Into Groups Based On Arbitrary Size

OK, For the duration of this question i will use a simple example: You ship stuff in boxes, and you can hold say 100 arbitrary units of space per box (just think in 2 dimensions) all of your units are flexable so we dont have to worry about conflicting shapes either, simple example. You want to sort these items of varying sizes into boxes such that the least amount of boxes are used to ship everything. How (Other than brute forcing each item combonation into each box and praying you find matches) can you accomplish this? Some algorithm? Also these items will eventually change in size over time, so i might have to re-sort the boxes on the fly. Im looking for a relatively fast way to do this all. Any input would be greatly appreciated.

2. This is a classic example of a classic problem

Or take a probability (or Monte Carlo) approach - that any "good" random solution will do and will take a lot less time to compute. If the random solution is on average within say 1% of the true answer, then 1% of the time, you'll ship one extra box.