## Self-Review Questions

- Use selection sort to sort the following numbers in ascending order:
`3 5 1 6 9 4 2`

- Use insertion sort to sort the following numbers in ascending order:
`3 5 1 6 9 4 2`

- What is the worst-case runtime complexity of insertion sort?

- What is the best-case runtime complexity of insertion sort?

- What is the worst-case runtime complexity of selection sort?

- What is the worst-case runtime complexity of mergesort?

- What is the best-case runtime complexity of mergesort?

- What is the worst-case runtime complexity of bucket sort?

- Given a million objects in memory (assume we have no memory constraints)
all of type
`HighSchoolStudent`

:
public class HighSchoolStudent
{
private String name;
private int numberOfYearsOld;
}

What sorting algorithm would you use, and why, to sort these
objects by the second field `numberOfYearsOld`

?

- Why would one ever choose insertion sort over mergesort?

- Why would one ever choose the bubble sort over the mergesort?

- True or False. Sorting 6 elements with a comparison sort
requires at least 10 comparisons.

Victor S.Adamchik, CMU, 2009