Elementary Sorts Questions

November 24th, 2014

Screen Shot 2014-11-16 at 3.06.54 PM

Classwork/Homework:
1. Which method runs faster for an array with all keys identical, selection sort or insertion sort?
2. Which method runs faster for an array in reverse order, selection sort or inser- tion sort?
3. Suppose that we use insertion sort on a randomly ordered array where elements have only one of three values. Is the running time linear, quadratic, or something in between?