Edexcel FD1 2022 June — Question 6

Exam BoardEdexcel
ModuleFD1 (Further Decision 1)
Year2022
SessionJune
TopicSorting Algorithms

6. The following algorithm determines the number of comparisons made when Prim’s algorithm is applied to \(\mathrm { K } _ { n }\) Step 1 Start
Step 2 Input the value of \(n\)
Step 3 Let \(a = 1\)
Step 4 Let \(b = n - 2\)
Step 5 Let \(c = b\)
Step 6 Let \(a = a + 1\)
Step \(7 \quad\) Let \(b = b - 1\)
Step 8 Let \(c = c + ( a \times b ) + ( a - 1 )\)
Step 9 If \(b > 0\) go to Step 6
Step 10 Output \(C\)
Step 11 Stop
  1. For \(\mathrm { K } _ { 5 }\), complete the table in the answer book to show the results obtained at each step of the algorithm. \begin{figure}[h]
    \includegraphics[alt={},max width=\textwidth]{27586973-89f4-45e1-9cc4-04c4044cd3db-11_595_703_175_680} \captionsetup{labelformat=empty} \caption{Figure 4}
    \end{figure} The weights of the ten arcs in Figure 4 are $$\begin{array} { l l l l l l l l l l } 17 & 21 & 24 & 14 & 23 & 13 & 15 & 19 & 28 & 20 \end{array}$$
    1. Starting at the left-hand end of the above list, sort the list into ascending order using bubble sort. You need only write down the state of the list at the end of each pass.
    2. Find the total number of comparisons performed during the sort.
  2. Find the maximum total number of comparisons required to sort the weights of the 10 arcs of \(\mathrm { K } _ { 5 }\) into ascending order using bubble sort. It is given that the maximum total number of comparisons required to sort the weights of the arcs of \(\mathrm { K } _ { n }\) into ascending order using bubble sort is $$\lambda n ( n - 1 ) ( n + 1 ) ( n - 2 )$$ where \(\lambda\) is a constant.
  3. Determine the maximum total number of comparisons required to sort the weights of the arcs of \(\mathrm { K } _ { 50 }\) into ascending order using bubble sort. You must make your method and working clear.