Problem

Suppose you have a number of boxes, each of which can hold total weight C and items i1, i2...

Suppose you have a number of boxes, each of which can hold total weight C and items i1, i2, i3, .. ., iN, which weigh w1, w2, w3, .. ., wN, respectively. The object is to pack all the items without placing more weight in any box than its capacity and using as few boxes as possible. For instance, if C = 5, and the items have weights 2, 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. Write programs 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 is no box with enough room). (This strategy and all that follow would give three boxes, 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?

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6