Question 5

OCR A Further Maths June 2023 Discrete mathematics (Y544-01)A level12 marks

On the specification

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

5 A list of 8 values is given below. 3 24 8 1 4 20 30 18 The list is to be sorted into increasing order using quick sort, as given in the Formulae Booklet. (a) Carry out the first two passes of the sort. [4] A different list of 8 values is to be sorted into increasing order using quick sort, as given in the Formulae Booklet. (b) (i) State the maximum number of passes that could be required. [1] (ii) Find the minimum number of passes that could be required. [2] The run-time for quick sort could be measured by counting the number of comparisons used. 2 In the worst case, the run time for quick sort is O(n ). A computer takes at most 0.03 seconds to sort a list of 100 values into increasing order using quick sort. (c) Calculate an estimate for the time taken, in the worst case, to sort a list of 500 values using quick sort. [2] A list of n values (where n 2 10) is to be sorted into increasing order using quick sort, as given in the Formulae Booklet. (d) Explain why, in the best case, n-3 comparisons are used in the second pass. [3]