| Exam Board | AQA |
|---|---|
| Module | D1 (Decision Mathematics 1) |
| Year | 2007 |
| Session | January |
| Marks | 8 |
| Paper | Download PDF ↗ |
| Mark scheme | Download PDF ↗ |
| Topic | Sorting Algorithms |
| Type | Counting Comparisons and Swaps |
| Difficulty | Moderate -0.8 This is a straightforward D1 question requiring only direct observation of a worked example and recall of bubble sort formulas. Part (a) involves counting from given data, and part (b) uses standard formulas (max comparisons = n(n-1)/2, max swaps same for worst case). No problem-solving or algorithmic insight required. |
| Spec | 7.03j Sorting: bubble sort and shuttle sort |
| Initial list | 18 | 17 | 13 | 26 | 10 | 14 | 24 |
| After 1st pass | 17 | 13 | 18 | 10 | 14 | 24 | 26 |
| After 2nd pass | 13 | 17 | 10 | 14 | 18 | 24 | 26 |
| After 3rd pass | 13 | 10 | 14 | 17 | 18 | 24 | 26 |
| After 4th pass | 10 | 13 | 14 | 17 | 18 | 24 | 26 |
| After 5th pass | 10 | 13 | 14 | 17 | 18 | 24 | 26 |
| Answer | Marks | Guidance |
|---|---|---|
| Comparisons: 6, 5, 4, 3, 2 with Swaps: 5, 3, 2, 1, 0 | B1B1, B1B1, B1, B1 | Other 3 comparisons; Other 3 swaps. Ignore 6th pass (6 marks total) |
| Answer | Marks | Guidance |
|---|---|---|
| \(21\); \(21\) | B1, B1 | (2 marks total) |
**4(a)**
| Comparisons: 6, 5, 4, 3, 2 with Swaps: 5, 3, 2, 1, 0 | B1B1, B1B1, B1, B1 | Other 3 comparisons; Other 3 swaps. Ignore 6th pass (6 marks total) |
**4(b)**
| $21$; $21$ | B1, B1 | (2 marks total) |
4
\begin{enumerate}[label=(\alph*)]
\item A student is using a bubble sort to rearrange seven numbers into ascending order.\\
Her correct solution is as follows:
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|l|}
\hline
Initial list & 18 & 17 & 13 & 26 & 10 & 14 & 24 \\
\hline
After 1st pass & 17 & 13 & 18 & 10 & 14 & 24 & 26 \\
\hline
After 2nd pass & 13 & 17 & 10 & 14 & 18 & 24 & 26 \\
\hline
After 3rd pass & 13 & 10 & 14 & 17 & 18 & 24 & 26 \\
\hline
After 4th pass & 10 & 13 & 14 & 17 & 18 & 24 & 26 \\
\hline
After 5th pass & 10 & 13 & 14 & 17 & 18 & 24 & 26 \\
\hline
\end{tabular}
\end{center}
Write down the number of comparisons and swaps on each of the five passes.
\item Find the maximum number of comparisons and the maximum number of swaps that might be needed in a bubble sort to rearrange seven numbers into ascending order.
\end{enumerate}
\hfill \mbox{\textit{AQA D1 2007 Q4 [8]}}