A bubble sort is used to put this list into ascending order.
[6, 2, 9, 1, 5](a) Show the list after the first pass. [2]
(b) Show the list after the second pass. [1]
(c) State how a bubble sort knows that the list is sorted. [1]
- (a) 9 has moved to the end(1)
- (a) Completely correct: [2, 6, 1, 5, 9](1)
- (b) [2, 1, 5, 6, 9](1)
- (c) A complete pass is made with no swaps; allow: when the swapped flag is still false at the end of a pass; allow: after n − 1 (here 4) passes have been made(1)
- Answer: (a) [2, 6, 1, 5, 9]; (b) [2, 1, 5, 6, 9]; (c) a pass with no swaps
- Examiner tip: One pass compares every adjacent pair once. Don't show the list after a single swap and call that a pass.