D1 January 2005 Q4

EdexcelOld spec11 marksAlgorithms

4.

650   431   245   643   455   134   710   234   162   452

(a) The list of numbers above is to be sorted into descending order. Perform a Quick Sort to obtain the sorted list, giving the state of the list after each pass, indicating the pivot elements. (5)

The numbers in the list represent the lengths, in mm, of some pieces of wood. The wood is sold in one metre lengths.

(b) Use the first-fit decreasing bin packing algorithm to determine how these pieces could be cut from the minimum number of one metre lengths. (You should ignore wastage due to cutting.) (4)
(c) Determine whether your solution to part (b) is optimal. Give a reason for your answer. (2)