AQA D1 2005 January — Question 2

Exam BoardAQA
ModuleD1 (Decision Mathematics 1)
Year2005
SessionJanuary
TopicSorting Algorithms

2
  1. Use a bubble sort algorithm to rearrange the following numbers into ascending order, showing the new arrangement after each pass. $$\begin{array} { l l l l l l l l } 19 & 3 & 7 & 20 & 2 & 6 & 5 & 15 \end{array}$$
  2. Write down the number of comparisons and the number of swaps during the first pass.
    (2 marks)