O'Reilly logo

Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

18.4. Bin Packing Problems

There is a set of math problems called bin packing problems that relate to the real world. Imagine that you have a bunch of items that you have to put into a box to ship. Each item has a size or shipping weight expressed as an integer and the box has a capacity expressed by another integer in the same units.

I take the box and start filling it. My goal is either to fill the box to capacity or to get as many single items as I can in the box (perhaps without filling it all the way). A more complex version also assigns value and item weight to each item; a very lightweight box can have a great value—a few grams of diamonds are worth more than a ton of sand. Another version has more than one box; another can have restrictions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required