AQA D1 2008 June — Question 2 7 marks

Exam BoardAQA
ModuleD1 (Decision Mathematics 1)
Year2008
SessionJune
Marks7
PaperDownload PDF ↗
Mark schemeDownload PDF ↗
TopicSorting Algorithms
TypeQuick Sort Execution
DifficultyEasy -1.2 This is a routine algorithmic execution question requiring mechanical application of standard sorting algorithms. Part (a) involves following the quick sort procedure step-by-step with a small list, and part (b) asks for recall of bubble sort properties (maximum swaps = n(n-1)/2 = 28, indicating reverse order). No problem-solving or novel insight required—purely procedural knowledge tested at a basic level.
Spec7.03j Sorting: bubble sort and shuttle sort7.03k Sorting: quick sort

2
  1. Use a quick sort to rearrange the following letters into alphabetical order. You must indicate the pivot that you use at each pass.
    P
    B
    M
    N
    J
    K
    R
    D
    (5 marks)
    1. Find the maximum number of swaps needed to rearrange a list of 8 numbers into ascending order when using a bubble sort.
      (1 mark)
    2. A list of 8 numbers was rearranged into ascending order using a bubble sort. The maximum number of swaps was needed. What can be deduced about the original list of numbers?
      (1 mark)

2(a)
AnswerMarks Guidance
Using quick sortM1
First pass (based on their pivot)A1
A correct third passA1
All passes correctA1
Consistent pivots clearly labelled (at least three passes)B1 5
B11
2(b)(i)
AnswerMarks
28
2(b)(ii)
AnswerMarks Guidance
In reverse orderB1 1
Allow descending
Total 7
## 2(a)
| Using quick sort | M1 | |
| First pass (based on their pivot) | A1 | |
| A correct third pass | A1 | |
| All passes correct | A1 | |
| Consistent pivots clearly labelled (at least three passes) | B1 | 5 |
| | B1 | 1 |

## 2(b)(i)
| 28 | | |

## 2(b)(ii)
| In reverse order | B1 | 1 |
| | | Allow descending |
| Total | | 7 |
2
\begin{enumerate}[label=(\alph*)]
\item Use a quick sort to rearrange the following letters into alphabetical order. You must indicate the pivot that you use at each pass.\\
P\\
B\\
M\\
N\\
J\\
K\\
R\\
D\\
(5 marks)
\item \begin{enumerate}[label=(\roman*)]
\item Find the maximum number of swaps needed to rearrange a list of 8 numbers into ascending order when using a bubble sort.\\
(1 mark)
\item A list of 8 numbers was rearranged into ascending order using a bubble sort. The maximum number of swaps was needed. What can be deduced about the original list of numbers?\\
(1 mark)
\end{enumerate}\end{enumerate}

\hfill \mbox{\textit{AQA D1 2008 Q2 [7]}}