Analyzing the Performance of the Selection Sort Algorithm
- The number of visits:
- n + 2 + (n - 1) + 2 + (n - 2) + 2 + . .
.+ 2 + 2
- This can be simplified to n2 /2 +
5n/2 - 3
- 5n/2 - 3 is small compared to n2 /2
– so let's ignore it
- Also ignore the 1/2 – it cancels out when comparing ratios