Suppose that you have a number of boxes, each of which can hold total weight I .O and items i_{1}, i_{2}, i_{3}, …, i_{N}, which weigh w_{1}, w_{2}, w_{3}, …, w_{N}, respectively. The object is to pack all the items, using as few boxes as possible, without placing more weight in any box than its capacity. For instance, if the items have weights 0.4, 0.4, 0.6 and 0.6, you can solve the problem with two boxes. This problem is difficult, and no efficient alogrithm is known. Several strategies give good, but not optimal, packings. Write programs to implement efficiently the following approximation strategies.

a. Scan the items in the order given; place each new item in the most-filled box that can accept it without overflowing. Use a priority queue to determine the box that an item goes in.

b. Sort the items, placing the heaviest item first; then use the strategy in part (a).