OCR D1 2015 June — Question 1 13 marks

Exam BoardOCR
ModuleD1 (Decision Mathematics 1)
Year2015
SessionJune
Marks13
PaperDownload PDF ↗
Mark schemeDownload PDF ↗
TopicSorting Algorithms
TypeBubble Sort Execution
DifficultyEasy -1.8 This is a purely procedural question requiring mechanical execution of two standard sorting algorithms with no problem-solving or insight. Students simply follow the algorithm steps they've memorized, count comparisons/swaps, and make a basic efficiency comparison—all routine recall and application for D1.
Spec7.03j Sorting: bubble sort and shuttle sort7.03k Sorting: quick sort

1 The following list is to be sorted into increasing order, from smallest to largest. $$\begin{array} { l l l l l l } 15 & 7 & 9 & 26 & 10 & 4 \end{array}$$ Bubble sort is to be used, starting at the left-hand end of the list, so that after the completion of the first pass the largest value will be at the right-hand end of the list.
  1. Write down the list that results at the end of the first pass through bubble sort. Write down the number of comparisons and the number of swaps that were made in this pass.
  2. After 3 passes the list is $$\begin{array} { l l l l l l } 7 & 9 & 4 & 10 & 15 & 26 \end{array}$$ Write down the list that results at the end of the fourth pass through bubble sort. Write down the number of comparisons and the number of swaps that were made in this pass.
  3. How many comparisons are needed in total to sort the list using bubble sort? Shuttle sort is then used to sort the original list, into increasing order, starting at the left-hand end of the list.
  4. Write down the list that results at the end of the first pass through shuttle sort. Write down the number of comparisons and the number of swaps that were made in this pass.
  5. After 3 passes the list is $$\begin{array} { l l l l l l } 7 & 9 & 15 & 26 & 10 & 4 \end{array}$$ Write down the list that results at the end of the fourth pass through shuttle sort. Write down the number of comparisons and the number of swaps that were made in this pass.
  6. How many comparisons and how many swaps are made in the fifth pass? In sorting the original list, both methods use a total of 9 swaps.
  7. Which of the two methods is the more efficient at sorting this list? Support your answer with a reason.

Question 1:
Part (i)
AnswerMarks Guidance
AnswerMarks Guidance
7, 9, 15, 10, 4, 26B1 Correct list after first pass
5 comparisonsB1
4 swapsB1
Part (ii)
AnswerMarks Guidance
AnswerMarks Guidance
7, 4, 9, 10, 15, 26B1 Correct list after fourth pass
3 comparisons, 1 swapB1 Both correct
Part (iii)
AnswerMarks Guidance
AnswerMarks Guidance
15 comparisonsB1 \(5+4+3+2+1 = 15\)
Part (iv)
AnswerMarks Guidance
AnswerMarks Guidance
7, 15, 9, 26, 10, 4B1 Correct list
1 comparison, 1 swapB1 Both correct
Part (v)
AnswerMarks Guidance
AnswerMarks Guidance
7, 9, 15, 26, 10, 4B1 Correct list after fourth pass
4 comparisons, 3 swapsB1 Both correct
Part (vi)
AnswerMarks Guidance
AnswerMarks Guidance
5 comparisons, 0 swapsB1 Both correct
Part (vii)
AnswerMarks Guidance
AnswerMarks Guidance
Bubble sort is more efficientB1
Bubble sort uses fewer comparisons (15 vs at least 15 for shuttle)B1 Valid supporting reason
# Question 1:

## Part (i)
| Answer | Marks | Guidance |
|--------|-------|----------|
| 7, 9, 15, 10, 4, 26 | B1 | Correct list after first pass |
| 5 comparisons | B1 | |
| 4 swaps | B1 | |

## Part (ii)
| Answer | Marks | Guidance |
|--------|-------|----------|
| 7, 4, 9, 10, 15, 26 | B1 | Correct list after fourth pass |
| 3 comparisons, 1 swap | B1 | Both correct |

## Part (iii)
| Answer | Marks | Guidance |
|--------|-------|----------|
| 15 comparisons | B1 | $5+4+3+2+1 = 15$ |

## Part (iv)
| Answer | Marks | Guidance |
|--------|-------|----------|
| 7, 15, 9, 26, 10, 4 | B1 | Correct list |
| 1 comparison, 1 swap | B1 | Both correct |

## Part (v)
| Answer | Marks | Guidance |
|--------|-------|----------|
| 7, 9, 15, 26, 10, 4 | B1 | Correct list after fourth pass |
| 4 comparisons, 3 swaps | B1 | Both correct |

## Part (vi)
| Answer | Marks | Guidance |
|--------|-------|----------|
| 5 comparisons, 0 swaps | B1 | Both correct |

## Part (vii)
| Answer | Marks | Guidance |
|--------|-------|----------|
| Bubble sort is more efficient | B1 | |
| Bubble sort uses fewer comparisons (15 vs at least 15 for shuttle) | B1 | Valid supporting reason |

---
1 The following list is to be sorted into increasing order, from smallest to largest.

$$\begin{array} { l l l l l l } 
15 & 7 & 9 & 26 & 10 & 4
\end{array}$$

Bubble sort is to be used, starting at the left-hand end of the list, so that after the completion of the first pass the largest value will be at the right-hand end of the list.\\
\begin{enumerate}[label=(\roman*)]
\item Write down the list that results at the end of the first pass through bubble sort. Write down the number of comparisons and the number of swaps that were made in this pass.
\item After 3 passes the list is

$$\begin{array} { l l l l l l } 
7 & 9 & 4 & 10 & 15 & 26
\end{array}$$

Write down the list that results at the end of the fourth pass through bubble sort. Write down the number of comparisons and the number of swaps that were made in this pass.
\item How many comparisons are needed in total to sort the list using bubble sort?

Shuttle sort is then used to sort the original list, into increasing order, starting at the left-hand end of the list.
\item Write down the list that results at the end of the first pass through shuttle sort. Write down the number of comparisons and the number of swaps that were made in this pass.
\item After 3 passes the list is

$$\begin{array} { l l l l l l } 
7 & 9 & 15 & 26 & 10 & 4
\end{array}$$

Write down the list that results at the end of the fourth pass through shuttle sort. Write down the number of comparisons and the number of swaps that were made in this pass.
\item How many comparisons and how many swaps are made in the fifth pass?

In sorting the original list, both methods use a total of 9 swaps.
\item Which of the two methods is the more efficient at sorting this list? Support your answer with a reason.
\end{enumerate}

\hfill \mbox{\textit{OCR D1 2015 Q1 [13]}}