| Exam Board | Edexcel |
|---|---|
| Module | D1 (Decision Mathematics 1) |
| Year | 2017 |
| Session | June |
| Marks | 11 |
| Paper | Download PDF ↗ |
| Mark scheme | Download PDF ↗ |
| Topic | Sorting Algorithms |
| Type | Quick Sort Execution |
| Difficulty | Easy -1.2 This is a straightforward application of standard D1 algorithms (bin packing and quick sort) with no conceptual challenges. Students simply execute learned procedures step-by-step: calculate sum/capacity for lower bound, apply first-fit mechanically, perform quick sort passes with clear pivot selection, then apply first-fit decreasing. All parts are routine algorithmic execution requiring only careful bookkeeping, making this easier than average A-level maths questions. |
| Spec | 7.03k Sorting: quick sort7.03l Bin packing: next-fit, first-fit, first-fit decreasing, full bin |
| Answer | Marks | Guidance |
|---|---|---|
| Answer/Scheme | Marks | Guidance |
| (a) Lower bound is 4 bins; \(19.1 \div 3.82 = 3.82\) so lower bound is 4 bins | M1 A1 | (2) CSO - correct calculation seen or 3.82 followed by 4 (bins) – accept 3.8 followed by 4 if correct calculation seen. An answer of 4 with no working scores M0A0 |
| (b) Bin 1: 2.5 0.9 1.4; Bin 2: 3.1 1.5 0.3; Bin 3: 2.0 1.9 0.4; Bin 4: 1.2; Bin 5: 3.9 | M1 A1 A1 | (3) First five items placed correctly and at least eight values placed in bins. Condone cumulative totals for M1 only (the values in bold). CSO - correct solution only – so no additional/repeated values |
| (c) Quick sort – pivot chosen (must be choosing middle left or middle right – choosing first/last item as pivot is M0). After the first pass the list must read (values greater than the pivot, pivot, values less than the pivot). Only choosing one pivot per iteration then M1 only – Bubble sort is not a MR and scores M1 only for 2.5 3.1 1.4 1.5 2.0 1.9 1.2 0.9 0.4 3.9 0.3 (for left to right) or 0.3 2.5 0.9 3.1 1.4 1.5 2.0 1.9 1.2 0.4 3.9 (right to left) | M1 A1 A1ft A1 | (4) First two passes correct and next pivots chosen correctly for third pass (but third pass does not need to be correct) – so they must be choosing (if middle right then a fifth pass in which the 0.4 is used as a pivot must be included or if middle left then a fifth pass in which the 0.3 is used as a pivot and a sixth pass in which the 0.9 is used as a pivot must be included). Third and fourth passes correct (follow through from their second pass and choice of pivots). They do not need to be choosing a pivot for the fifth pass for this mark. CSO (correct solution only – all previous marks in this part must have been awarded) - if middle right then a fifth pass in which the 0.4 is used as a pivot must be included or if middle left then a fifth pass in which the 0.3 is used as a pivot and a sixth pass in which the 0.9 is used as a pivot must be included |
| (d) Bin 1: 3.9 0.9; Bin 2: 3.1 1.9; Bin 3: 2.5 2.0 0.4; Bin 4: 1.5 1.4 1.2 0.3 | M1 A1 | (2) Must be using sorted list in descending order. First six items placed correctly and at least eight values placed in bins – condone cumulative totals for M1 only (the bold values). CSO (so no additional/repeated values) |
| 11 marks |
| Answer/Scheme | Marks | Guidance |
|---|---|---|
| (a) Lower bound is 4 bins; $19.1 \div 3.82 = 3.82$ so lower bound is 4 bins | M1 A1 | (2) CSO - correct calculation seen or 3.82 followed by 4 (bins) – accept 3.8 followed by 4 if correct calculation seen. An answer of 4 with no working scores M0A0 |
| (b) Bin 1: 2.5 **0.9** 1.4; Bin 2: 3.1 **1.5** 0.3; Bin 3: 2.0 **1.9** 0.4; Bin 4: 1.2; Bin 5: 3.9 | M1 A1 A1 | (3) First five items placed correctly and at least eight values placed in bins. Condone cumulative totals for M1 only (the values in bold). CSO - correct solution only – so no additional/repeated values |
| (c) Quick sort – pivot chosen (must be choosing middle left or middle right – choosing first/last item as pivot is M0). After the first pass the list must read (values greater than the pivot, pivot, values less than the pivot). Only choosing one pivot per iteration then M1 only – Bubble sort is not a MR and scores M1 only for 2.5 3.1 1.4 1.5 2.0 1.9 1.2 0.9 0.4 3.9 0.3 (for left to right) or 0.3 2.5 0.9 3.1 1.4 1.5 2.0 1.9 1.2 0.4 3.9 (right to left) | M1 A1 A1ft A1 | (4) First two passes correct and next pivots chosen correctly for third pass (but third pass does not need to be correct) – so they must be choosing (if middle right then a fifth pass in which the 0.4 is used as a pivot must be included or if middle left then a fifth pass in which the 0.3 is used as a pivot and a sixth pass in which the 0.9 is used as a pivot must be included). Third and fourth passes correct (follow through from their second pass and choice of pivots). They do not need to be choosing a pivot for the fifth pass for this mark. CSO (correct solution only – all previous marks in this part must have been awarded) - if middle right then a fifth pass in which the 0.4 is used as a pivot must be included or if middle left then a fifth pass in which the 0.3 is used as a pivot and a sixth pass in which the 0.9 is used as a pivot must be included |
| (d) Bin 1: 3.9 0.9; Bin 2: 3.1 1.9; Bin 3: 2.5 2.0 0.4; Bin 4: 1.5 1.4 1.2 0.3 | M1 A1 | (2) Must be using sorted list in descending order. First six items placed correctly and at least eight values placed in bins – condone cumulative totals for M1 only (the bold values). CSO (so no additional/repeated values) |
| | **11 marks** | |
**Misreads:** If the candidate has misread a number at the start of (a), so genuinely miscopy a number from the paper then mark the whole of (a), (b), (c) and (d) as a misread – removing the last two A marks earned. This gives a maximum of 9 marks in total for these four parts.
If they have used the correct numbers in say (a) and (b) and then use an incorrect number in (c) (say 5.2 instead of 2.5) or misread one of their own numbers during (c) then count it as one 'error' in either (c) (so they will lose at least the final A mark in (c) but should be able to gain at least the M mark and the follow through A mark) – then award the marks in (d) as per the main scheme. More than one 'error' in (c) loses all subsequent A marks in (c).
**Sorting list into ascending order in (c):**
- If the candidate sorts the list into ascending order and reverses the list in this part then this can score full marks in (c)
- If the list is not reversed in (c) then mark as a misread (so remove the last two A marks earned in (c)). If the list is reversed at the start of (d) but not in (c) then still treat this as a misread. If the list is in ascending order in (c) award no marks for first-fit increasing in (d). If the candidate says that the list needs reversing in (c) but does not actually show the reversed list in (c) then remove the final A mark earned
- **Middle left**
```
2.5 0.9 3.1 1.4 1.5 2.0 1.9 1.2 0.3 0.4 3.9 Pivot(s): 2.0
2.5 3.1 3.9 2.0 0.9 1.4 1.5 1.9 1.2 0.3 0.4 3.1 1.9
3.9 3.1 2.5 2.0 1.9 0.9 1.4 1.5 1.2 0.3 0.4 (3.9) (2.5) 1.5
3.9 3.1 2.5 2.0 1.9 1.4 1.5 1.2 0.9 0.3 0.4 1.5 0.3
3.9 3.1 2.5 2.0 1.9 1.5 1.4 1.2 0.9 0.4 0.3 (1.4) 0.4
3.9 3.1 2.5 2.0 1.9 1.5 1.4 1.2 0.9 0.4 0.3 (0.9)
```
- **Ascending Middle right**
```
2.5 0.9 3.1 1.4 1.5 2.0 1.9 1.2 0.3 0.4 3.9 Ascending Middle left
0.9 1.4 1.5 1.9 1.2 0.3 0.4 2.0 2.5 3.1 3.9 2.5 0.9 3.1 1.4 1.5 2.0 1.9 1.2 0.3 0.4 3.9
0.9 1.4 1.5 1.2 0.3 0.4 1.9 2.0 2.5 3.1 3.9 0.9 1.4 1.5 1.9 1.2 0.3 0.4 2.0 2.5 3.1 3.9
0.9 1.4 1.5 1.2 0.3 0.4 1.9 2.0 2.5 3.1 3.9 0.9 1.4 1.5 1.2 0.3 0.4 1.9 2.0 2.5 3.1 3.9
0.9 0.3 0.4 1.2 1.4 1.5 1.9 2.0 2.5 3.1 3.9 0.9 1.2 0.3 0.4 1.5 1.9 2.0 2.5 3.1 3.9
0.3 0.4 0.9 1.2 1.4 1.5 1.9 2.0 2.5 3.1 3.9 0.3 0.9 0.4 1.2 1.4 1.5 1.9 2.0 2.5 3.1 3.9
0.3 0.4 0.9 1.2 1.4 1.5 1.9 2.0 2.5 3.1 3.9
Sort complete Sort complete
```
---
1.
$$\begin{array} { l l l l l l l l l l l }
2.5 & 0.9 & 3.1 & 1.4 & 1.5 & 2.0 & 1.9 & 1.2 & 0.3 & 0.4 & 3.9
\end{array}$$
The numbers in the list are the lengths, in metres, of eleven pieces of wood. They are to be cut from planks of wood of length 5 metres. You should ignore wastage due to cutting.
\begin{enumerate}[label=(\alph*)]
\item Calculate a lower bound for the number of planks needed. You must make your method clear.
\item Use the first-fit bin packing algorithm to determine how these pieces could be cut from 5 metre planks.
\item Carry out a quick sort to produce a list of the lengths in descending order. You should show the result of each pass and identify your pivots clearly.
\item Use the first-fit decreasing bin packing algorithm to determine how these pieces could be cut from 5 metre planks.
\end{enumerate}
\hfill \mbox{\textit{Edexcel D1 2017 Q1 [11]}}