Question 3

OCR A Further Maths June 2023 Discrete mathematics (Y534-01)AS12 marks

On the specification

(a)(i)
7.03 Algorithms
(a)(ii)
7.03 Algorithms
(b)(i)
7.03 Algorithms
(b)(ii)
7.03 Algorithms
(c)
7.03 Algorithms
(d)
7.03 Algorithms
Question text

3 The list of numbers below is to be sorted into increasing order. 23 10 18 7 62 54 31 82 (a) Sort the list using bubble sort. You do not need to show intermediate working. (i) Record the list that results at the end of each pass. [3] (ii) Record the number of swaps used in each pass. [2] (b) Now sort the original list using shuttle sort. You do not need to show intermediate working. (i) Record the list that results at the end of each pass. [3] (ii) Record the number of swaps used in each pass. [2] (c) Using the total number of comparisons plus the total number of swaps as a measure of efficiency, explain why shuttle sort is more efficient than bubble sort for sorting this particular list. [1] 2 Bubble sort and shuttle sort are both O(n ). (d) Explain what this means for the run-time of the algorithms when the length of the list being sorted changes from 1000 to 3000. [1]