OCR Further Discrete 2023 June — Question 5

Exam BoardOCR
ModuleFurther Discrete (Further Discrete)
Year2023
SessionJune
TopicNumber Theory

5 A list of 8 values is given below.
324814203018
The list is to be sorted into increasing order using quick sort, as given in the Formulae Booklet.
  1. Carry out the first two passes of the sort. A different list of 8 values is to be sorted into increasing order using quick sort, as given in the Formulae Booklet.
    1. State the maximum number of passes that could be required.
    2. Find the minimum number of passes that could be required. The run-time for quick sort could be measured by counting the number of comparisons used. In the worst case, the run time for quick sort is \(\mathrm { O } \left( n ^ { 2 } \right)\). A computer takes at most 0.03 seconds to sort a list of 100 values into increasing order using quick sort.
  2. Calculate an estimate for the time taken, in the worst case, to sort a list of 500 values using quick sort. A list of \(n\) values (where \(n > 10\) ) is to be sorted into increasing order using quick sort, as given in the Formulae Booklet.
  3. Explain why, in the best case, \(n - 3\) comparisons are used in the second pass.