Question 9. [7 MARKS]
Recall the algorithms insertion sort, selection sort, and bubble sort. Throughout this question, lists are to
be sorted into ascending (increasing) order.
Part (a) [1 MARK]
Consider the following lists:
L1 = [1, 3, 4, 5, 2, 6, 7, 8, 9]
L2 = [9, 8, 7, 6, 5, 4, 3, 2, 1]
Which list would cause Selection Sort to do more comparisons? Circle one of the following.
L1
L2
they would require an equal number
Part (b) [1 MARK]
Consider the following lists:
L1 = [1, 3, 4, 5, 2, 6, 7, 8, 9]
L2 = [9, 8, 7, 6, 5, 4, 3, 2, 1]
Which list would cause Insertion Sort to do more comparisons? Circle one of the following.
L1
L2
they would require an equal number
Part (c) [5 MARKS] Consider the following lists. For each list, and each algorithm, consider whether at
least two passes of the algorithm could have been completed on the list. If at least two passes could have
been completed, check the box corresponding to that list and algorithm.
Insertion? Selection? Bubble?
[1, 2, 4, 6, 5, 7, 3]
[1, 3, 4, 6, 5, 7, 2]
[1, 3, 4, 5, 2, 6, 7]
[5, 4, 3, 2, 1, 6, 7]
[1, 2, 4, 5, 6, 7, 8]