OCR D1 2016 June — Question 2 9 marks

Exam BoardOCR
ModuleD1 (Decision Mathematics 1)
Year2016
SessionJune
Marks9
PaperDownload PDF ↗
Mark schemeDownload PDF ↗
TopicSorting Algorithms
TypeComparing Sorting Algorithms
DifficultyModerate -0.8 This question tests recall and mechanical application of standard sorting algorithms (bubble sort, shuttle sort) and bin-packing methods. All parts require following learned procedures with no problem-solving or novel insight—students simply need to recognize algorithm patterns and execute steps. The conceptual demand is low for A-level, making it easier than average.
Spec7.03j Sorting: bubble sort and shuttle sort7.03k Sorting: quick sort7.03l Bin packing: next-fit, first-fit, first-fit decreasing, full bin

2 Shaun measured the mass, in kg, of each of 9 filled bags. He then used an algorithm to sort the masses into increasing order. Shaun's list after the first pass through the sorting algorithm is given below. $$\begin{array} { l l l l l l l l l } 32 & 41 & 22 & 37 & 53 & 43 & 29 & 15 & 26 \end{array}$$
  1. Explain how you know that Shaun did not use bubble sort. In fact, Shaun used shuttle sort, starting at the left-hand end of the list.
  2. Write down the two possibilities for the original list.
  3. Write down the list after the second pass through the shuttle sort algorithm.
  4. How many passes through shuttle sort were needed to sort the entire list? Shaun's sorted list is given below. $$\begin{array} { l l l l l l l l l } 15 & 22 & 26 & 29 & 32 & 37 & 41 & 43 & 53 \end{array}$$ Shaun wants to pack the bags into bins, each of which can hold a maximum of 100 kg .
  5. Write the list in decreasing order of mass and then apply the first-fit decreasing method to decide how to pack the bags into bins. Write the weights of the bags in each bin in the order that they are put into the bin.
  6. Find a way to pack all the bags using only 3 bins, each of which can hold a maximum of 100 kg .

Question 2:
(i)
AnswerMarks
After bubble sort, largest value (53) would be at the right-hand end, but 53 is not at the right-hand end (26 is)B1
(ii)
AnswerMarks Guidance
Original list: 32 41 22 37 53 43 15 29 26 or 32 41 22 37 53 43 29 15 26B1 Either possibility
(iii)
AnswerMarks Guidance
After second pass: 32 22 37 41 53 43 15 29 2622 32 37 41 53 43 15 29 26 (dependent on original)B1 Follow through from (ii)
(iv)
AnswerMarks
8 passesB1
(v)
AnswerMarks Guidance
Decreasing order: 53, 43, 41, 37, 32, 29, 26, 22, 15M1 Correct decreasing order stated
Bin 1: 53, 43 (total 96); Bin 2: 41, 37, 22 (total 100); Bin 3: 32, 29, 26, 15 (wait — check sums)M1 Applying FFD correctly
Bin 1: 53, 43 (96); Bin 2: 41, 37, 22 (100); Bin 3: 32, 29, 26, 15 (102 — overflow)
Bin 1: 53, 43 (96); Bin 2: 41, 37, 22 (100); Bin 3: 32, 29, 26 (87); Bin 4: 15A1 4 bins needed
(vi)
AnswerMarks Guidance
Bin 1: 53, 22, 15 (90); Bin 2: 43, 29, 26 (98); Bin 3: 41, 37, 22...M1 Valid attempt using 3 bins
e.g. Bin 1: 53, 32, 15 (100); Bin 2: 43, 29, 26 (98) [check: 22+41+37=100 ✓] Bin 3: 41, 37, 22 (100)A1 All three bins ≤100, all items included
# Question 2:

**(i)**
| After bubble sort, largest value (53) would be at the right-hand end, but 53 is not at the right-hand end (26 is) | B1 | |

**(ii)**
| Original list: **32 41 22 37 53 43 15 29 26** or **32 41 22 37 53 43 29 15 26** | B1 | Either possibility |

**(iii)**
| After second pass: **32 22 37 41 53 43 15 29 26** → **22 32 37 41 53 43 15 29 26** (dependent on original) | B1 | Follow through from (ii) |

**(iv)**
| **8 passes** | B1 | |

**(v)**
| Decreasing order: 53, 43, 41, 37, 32, 29, 26, 22, 15 | M1 | Correct decreasing order stated |
| Bin 1: 53, 43 (total 96); Bin 2: 41, 37, 22 (total 100); Bin 3: 32, 29, 26, 15 (wait — check sums) | M1 | Applying FFD correctly |
| Bin 1: 53, 43 (96); Bin 2: 41, 37, 22 (100); Bin 3: 32, 29, 26, 15 (102 — overflow) | | |
| Bin 1: 53, 43 (96); Bin 2: 41, 37, 22 (100); Bin 3: 32, 29, 26 (87); Bin 4: 15 | A1 | 4 bins needed |

**(vi)**
| Bin 1: 53, 22, 15 (90); Bin 2: 43, 29, 26 (98); Bin 3: 41, 37, 22... | M1 | Valid attempt using 3 bins |
| e.g. Bin 1: 53, 32, 15 (100); Bin 2: 43, 29, 26 (98) [check: 22+41+37=100 ✓] Bin 3: 41, 37, 22 (100) | A1 | All three bins ≤100, all items included |

---
2 Shaun measured the mass, in kg, of each of 9 filled bags. He then used an algorithm to sort the masses into increasing order.

Shaun's list after the first pass through the sorting algorithm is given below.

$$\begin{array} { l l l l l l l l l } 
32 & 41 & 22 & 37 & 53 & 43 & 29 & 15 & 26
\end{array}$$

\begin{enumerate}[label=(\roman*)]
\item Explain how you know that Shaun did not use bubble sort.

In fact, Shaun used shuttle sort, starting at the left-hand end of the list.
\item Write down the two possibilities for the original list.
\item Write down the list after the second pass through the shuttle sort algorithm.
\item How many passes through shuttle sort were needed to sort the entire list?

Shaun's sorted list is given below.

$$\begin{array} { l l l l l l l l l } 
15 & 22 & 26 & 29 & 32 & 37 & 41 & 43 & 53
\end{array}$$

Shaun wants to pack the bags into bins, each of which can hold a maximum of 100 kg .
\item Write the list in decreasing order of mass and then apply the first-fit decreasing method to decide how to pack the bags into bins. Write the weights of the bags in each bin in the order that they are put into the bin.
\item Find a way to pack all the bags using only 3 bins, each of which can hold a maximum of 100 kg .
\end{enumerate}

\hfill \mbox{\textit{OCR D1 2016 Q2 [9]}}