A2 June 2024 Q1

EdexcelCurrent spec7 marksAlgorithms

1.

17816122419231120134

The eleven numbers listed above are to be packed into bins of size \(n\) where \(n\) is a positive integer. When the first-fit bin packing algorithm is applied to the eleven numbers, the bins are packed as shown below.

Bin 1:17   8   12
Bin 2:16   24
Bin 3:19   11   4
Bin 4:23   13
Bin 5:20
(a) Explain why this packing means that the value of \(n\) must be 40 (1)

The original list of eleven numbers is to be sorted into descending order.

(b) Use a quick sort to obtain the fully sorted list. You must make your pivots clear. (4)
(c) Apply the first-fit decreasing bin packing algorithm to the fully sorted list to pack the numbers into bins of size 40 (2)