AQA D1 2008 January — Question 7

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

7 The numbers 17, 3, 16 and 4 are to be sorted into ascending order.
The following four methods are to be compared: bubble sort, shuttle sort, Shell sort and quick sort (with the first number used as the pivot). A student uses each of the four methods and produces the correct solutions below. Each solution shows the order of the numbers after each pass.
\multirow[t]{4}{*}{Solution 1}173164
317164
316174
341617
\multirow[t]{3}{*}{Solution 2}173164
163174
341617
\multirow[t]{4}{*}{Solution 3}173164
316417
316417
341617
\multirow[t]{4}{*}{Solution 4}173164
316417
341617
341617
  1. Write down which of the four solutions is the bubble sort, the shuttle sort, the Shell sort and the quick sort.
  2. For each of the four solutions, write down the number of comparisons and swaps (exchanges) on the first pass.