Sign in
United Kingdom › MYP Mathematics › Algebra
Question

Bubble Sorting Race Times

A10 · C1 · 11 marks · ~11 min
✦ Created by our AI question engine · answers checked by script Self-marked 0 / 9
How this page works Full help
  1. Read the question and the information above the parts.
  2. Write your working and your answer in the box for each part, with units, as in the exam. Press Enter for a new line.
  3. Check your final line with Check my answer. Use the calculator on the right when you need it.
  4. Mark yourself: open the markscheme and tick each mark you earned.

At a sports day in Leicester, five runners record their 100 m times in seconds. The times are entered in this order:

ZaraTomInésKaiRuth
14.212.815.111.913.4

Mr Novak uses a bubble sort to put the times in order, quickest first.

  • One pass: compare the 1st and 2nd times and swap them if the first is larger. Then compare the 2nd and 3rd times, and so on, until the last two times have been compared.
  • Repeat passes until a pass makes no swaps. Then stop.
443.1
A1 Level 1–2
[1]Write down how many comparisons are made in one pass through the five times.
Checks your final line. Mark a different line with ★ if your answer is not the last line.
Markscheme · 1 mark

Model answer

Pairs 1–2, 2–3, 3–4, 4–5: 4 comparisons.
4

Mark yourself

443.2
A2 Level 3–4
[2]Find the number of swaps made in the first pass.
Checks your final line. Mark a different line with ★ if your answer is not the last line.
Markscheme · 2 marks

Model answer

14.2 > 12.8 swap → 12.8, 14.2, 15.1, 11.9, 13.4. 14.2 < 15.1 no swap. 15.1 > 11.9 swap → …, 11.9, 15.1, 13.4. 15.1 > 13.4 swap. 3 swaps.
3

Mark yourself

443.3
A2 Level 3–4
[2]Put the times in the order they are in after the first pass.
Checks your final line. Mark a different line with ★ if your answer is not the last line.
Markscheme · 2 marks

Model answer

After the first pass: 12.8, 14.2, 11.9, 13.4, 15.1.
12.8, 14.2, 11.9, 13.4, 15.1

Mark yourself

443.4
A2 Level 5–6
[2]Find the total number of passes the algorithm makes, including the final pass with no swaps.
Checks your final line. Mark a different line with ★ if your answer is not the last line.
Markscheme · 2 marks

Model answer

Pass 2: 12.8, 11.9, 13.4, 14.2, 15.1 (2 swaps). Pass 3: 11.9, 12.8, 13.4, 14.2, 15.1 (1 swap). Pass 4: no swaps, so stop. 4 passes.
4

Mark yourself

443.5
A1 · C1 Level 5–6
[2]Explain why, after the first pass, the largest time is always at the end of the list, whatever order the times start in.
Checks your final line. Mark a different line with ★ if your answer is not the last line.
Markscheme · 2 marks

Model answer

Once the largest time is reached, it is larger than every time after it, so it is swapped at every later comparison. It is carried along to the last position.
The largest time is swapped at every comparison after it is reached, so it is carried to the end.

Mark yourself

443.6
A2 Level 7–8
[2]In a later race, six times are entered already in order, quickest first. Find the total number of comparisons the bubble sort makes before it stops.
Checks your final line. Mark a different line with ★ if your answer is not the last line.
Markscheme · 2 marks

Model answer

The first pass makes 6 − 1 = 5 comparisons and no swaps, so the algorithm stops after one pass. Total 5 comparisons.
5

Mark yourself

Solves
0
Average rating
–
Open reports
0

Assessment criteria

A
Knowing and understanding
B
Investigating patterns
C
Communicating
D
Applying mathematics in real-life contexts

Quality checks

  • Created by our AI question engine
  • Every number checked by script
  • Published for students