Discrete Mathematics June 2025, Question 3 8 marks
Hiro uses a sorting algorithm to sort the heights in cm of 8 people into ascending order.
At the end of the first pass through the algorithm, Hiro ends up with the list below:
142 165 152 135 171 154 172 182
If Hiro used the shuttle sort algorithm, write down the possibilities for the original list.
Reveal mark scheme
Hiro actually used the bubble sort algorithm starting at the left-hand side.
Complete the second and third passes using the bubble sort algorithm.
You should show the list that results at the end of each pass.
Reveal mark scheme
In total, Hiro needed 5 passes to complete the bubble sort algorithm.
In total, the shuttle sort algorithm would take 12 comparisons to sort the original list into ascending order.
Using the total number of comparisons for each algorithm, compare the efficiency of
bubble sort and shuttle sort for sorting the heights of the 8 people.
Reveal mark scheme
It takes a computer 2.4 × 10-3 seconds to sort a list of 300 numbers into ascending order using the bubble sort algorithm.
Find the approximate length of a list the computer could sort in 1 minute. Give your answer
to 1 significant figure.
Reveal mark scheme