A2 June 2025 Q2

EdexcelCurrent spec10 marksAlgorithms

2.

271828182845904523536028747135

The list of ten numbers above is to be sorted into descending order.

(a) Perform a quick sort on the list to obtain the sorted list. You should show the result of each pass and identify the pivots clearly. (4)

A list of \(n\) numbers is to be sorted into descending order using bubble sort.

(b) Determine, in the worst case, the total number of comparisons required to sort the list. Give your answer as a simplified expression in terms of \(n\). (2)

The following algorithm determines an approximation to the value of e

Step 1Start
Step 2Let \(a = 1\)
Step 3Let \(b = 1\)
Step 4Let \(c = 1\)
Step 5Let \(d = a\)
Step 6Let \(c = c \times b\)
Step 7Let \(d = d + \frac{1}{c}\)
Step 8If \(b = 6\) go to Step 11
Step 9Let \(b = b + 1\)
Step 10Go to Step 6
Step 11Output \(d\)
Step 12Stop
(c) Complete the table in the answer book to show the results obtained at each step of the algorithm. (3)

[The table in the answer book has columns headed \(a\), \(b\), \(c\), \(d\). You may not need to use all the rows in this table. It may not be necessary to complete all boxes in each row.]

\(a\)\(b\)\(c\)\(d\)
 
 
(d) Calculate, to 3 significant figures, the percentage error in using the value found in (c) to approximate the value of e (1)