I'm a bit confused with the performance guarantee and complexity of
I checked through internet and the complexity of selection sort is
O(n^2). This O(n^2) is in terms of time complexity, am i right?
Right. It's the total number of constant factor * constant time operations dependent on the input size (this is still simplified).
So how about performance guarantee? Is the performance guarantee in my
case measured in terms of swapping or in time complexity as well? If
the performance guarantee is in terms of swapping, so best case of
swapping is zero swaps (the array is already sorted) and the worst
case of swapping is n-1 step? The performance guarantee is then equal
to (n-1)/0=undefined, am I correct?
I don't know what you consider a performance guarantee, but the big O notation guarantees us, that an O(n^2) algorithm won't run slower than this bound indicates. A performance guarantee should not only be given in terms of swapping, you have to look at the whole algorithm. But you can explicitly ask for a performance guarantee for swapping in a specific algorithm, if that is of interest to you (for whatever reason). For selection sort this is Theta(n) as you always swap n-1 times with classic selection sort, the algorithm somtimes swaps an item with itself (which is still not a zero time operation, because I doubt the compiler can optimize it away in every case).
Please correct me if im wrong...or is the performance guarantee is in
terms of running time? Then performance guarantee will be (n-1)/(n-1)
In my opinion, performance guarantee is a measurement for the grade of solutions of heuristic algorithms. You simply compare the approximated solution to the known optimal solution and calculate how close it really is. I am not completely sure about this, though.
If I had to apply this to sort of thinking to sorting algorithms that swap, then I'd argue that the best case for swapping is always O(n). And as selection sort swaps Theta(n) times the "performance guarantee for swapping" is probably 1. When I want to guarantee something, then I am usually concerned about the worst kinds of behaviour. So in the worst case an optimal solutions swaps n-1 times and so does selection sort. It'd be pointless to take the best case of an optimal solution.