Suppose you have a number of boxes, each of which can hold total weight C anditems i1
Chapter 6, Problem 6.37(choose chapter or problem)
Suppose you have a number of boxes, each of which can hold total weight C anditems i1, i2, i3, ... , iN, which weigh w1, w2, w3, ... , wN, respectively. The object isto pack all the items without placing more weight in any box than its capacity andusing as few boxes as possible. For instance, if C = 5, and the items have weights2, 2, 3, 3, then we can solve the problem with two boxes.In general, this problem is very hard, and no efficient solution is known. Writeprograms to implement efficiently the following approximation strategies:a. Place the weight in the first box for which it fits (creating a new box if there isno box with enough room). (This strategy and all that follow would give threeboxes, which is suboptimal.)b. Place the weight in the box with the most room for it.c. Place the weight in the most filled box that can accept it without overflowing.d. Are any of these strategies enhanced by presorting the items by weight?
Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.
Becoming a subscriber
Or look for another answer