OCR MEI D1 2006 January — Question 2 8 marks

Exam BoardOCR MEI
ModuleD1 (Decision Mathematics 1)
Year2006
SessionJanuary
Marks8
PaperDownload PDF ↗
Mark schemeDownload PDF ↗
TopicSorting Algorithms
TypeAlgorithm Tracing
DifficultyEasy -1.2 This is a straightforward algorithm tracing exercise requiring students to follow given instructions step-by-step and count operations. Parts (i)-(iii) involve mechanical execution with no problem-solving, while part (iv) requires only basic reasoning about best/worst cases for merging two sorted lists (max = x+y-1, min = min(x,y)). This is easier than average A-level content as it tests procedural following rather than mathematical insight.
Spec7.03d Order of algorithm: dominant term and scaling run-times7.03j Sorting: bubble sort and shuttle sort

  1. Complete the table in the insert showing the outcome of applying the algorithm to the following two lists: $$\begin{array} { l r l l l l l } \text { List 1: } & 2 , & 34 , & 35 , & 56 & & \\ \text { List 2: } & 13 , & 22 , & 34 , & 81 , & 90 , & 92 \end{array}$$
  2. What does the algorithm achieve?
  3. How many comparisons did you make in applying the algorithm?
  4. If the number of elements in List 1 is \(x\), and the number of elements in List 2 is \(y\), what is the maximum number of comparisons that will have to be made in applying the algorithm, and what is the minimum number?

AnswerMarks
(i) Merge sort algorithm traced through steps showing Lists 1, 2, 3 progressively merged to produce ordered final listM1 sca; A1 to first step 3 inc.; A1 to second step 3; A1 rest
(ii) Merges ordered lists to give an ordered listB1
(iii) Number of passes: 7B1
(iv) \(\text{Max} = x + y - 1\); \(\text{Min} = \min(x, y)\)B1; B1
**(i)** Merge sort algorithm traced through steps showing Lists 1, 2, 3 progressively merged to produce ordered final list | M1 sca; A1 to first step 3 inc.; A1 to second step 3; A1 rest |

**(ii)** Merges ordered lists to give an ordered list | B1 |

**(iii)** Number of passes: 7 | B1 |

**(iv)** $\text{Max} = x + y - 1$; $\text{Min} = \min(x, y)$ | B1; B1 |

---
(i) Complete the table in the insert showing the outcome of applying the algorithm to the following two lists:

$$\begin{array} { l r l l l l l } 
\text { List 1: } & 2 , & 34 , & 35 , & 56 & & \\
\text { List 2: } & 13 , & 22 , & 34 , & 81 , & 90 , & 92
\end{array}$$

(ii) What does the algorithm achieve?\\
(iii) How many comparisons did you make in applying the algorithm?\\
(iv) If the number of elements in List 1 is $x$, and the number of elements in List 2 is $y$, what is the maximum number of comparisons that will have to be made in applying the algorithm, and what is the minimum number?

\hfill \mbox{\textit{OCR MEI D1 2006 Q2 [8]}}