Problem set #20 -- due Friday 5/12
1. If you had to sort a list of numbers that was almost sorted (i.e.,
just a couple of the numbers are out of order) which algorithm do you
think would be more efficient: selection sort or insertion sort? Why?
2. We have two algorithms for solving a problem. Algorithm A's
running time is linear (which we write as: O(n)) and algorithm B's
running time is quadratic (which we write as: O(n^2)). Does this mean
that it would always be more efficient (faster) to use algorithm A?