The code can be downloaded from here.
- If f(n) denotes the number comparisons made by
SelectionSort for a data set of size n, what is the smallest
value of k for which f(n) = O(nk)?
k=2
- Count the number of comparisons - does your experimental
evidence match the analysis?
The number of comparisions is n(n-1)/2. YES.
- Do the number of comparisons depend on the input data?
YES.