Edexcel D1 2015 January — Question 3

Exam BoardEdexcel
ModuleD1 (Decision Mathematics 1)
Year2015
SessionJanuary
TopicCombinations & Selection

3. $$\begin{array} { l l l l l l l l l l } 1.1 & 0.7 & 1.9 & 0.9 & 2.1 & 0.2 & 2.3 & 0.4 & 0.5 & 1.7 \end{array}$$
  1. Use the first-fit bin packing algorithm to determine how the numbers listed above can be packed into bins of size 3 The list is to be sorted into descending order.
    1. Starting at the left-hand end of the list, perform one pass through the list using a bubble sort. Write down the list that results at the end of your first pass.
    2. Write down the number of comparisons and the number of swaps performed during your first pass. After a second pass using this bubble sort, the updated list is $$\begin{array} { l l l l l l l l l l } 1.9 & 1.1 & 2.1 & 0.9 & 2.3 & 0.7 & 0.5 & 1.7 & 0.4 & 0.2 \end{array}$$
  2. Use a quick sort on this updated list to obtain the fully sorted list. You must make your pivots clear.
  3. Apply the first-fit decreasing bin packing algorithm to your fully sorted list to pack the numbers into bins of size 3