D1 January 2010 Q4

EdexcelOld spec11 marksAlgorithms

4. A builder is asked to replace the guttering on a house.  The lengths needed, in metres, are

0.6,  4.0,  2.5,  3.2,  0.5,  2.6,  0.4,  0.3,  4.0 and 1.0

Guttering is sold in 4 m lengths.

(a) Carry out a quick sort to produce a list of the lengths needed in descending order.  You should show the result of each pass and identify your pivots clearly. (5)
(b) Apply the first-fit decreasing bin-packing algorithm to your ordered list to determine the total number of 4 m lengths needed. (4)
(c) Does the answer to part (b) use the minimum number of 4 m lengths?  You must justify your answer. (2)