Question: What is the efficiency and big O of the selection sort algorithm when the input happens to already be in nondecreasing order?
Answer: Not sure... since the input is in nondecreasing order, such that example 0, 1, 1, 2, 3, 4, 4, 5 then there will be no swap, Just comparisons of emelemts.
So it is big O of n
your correct that the number of swaps will be 0 but selection sort will still require n^2 comparisons regardless of what order the data is in so if i recall correctly it will still be O(n^2).
The big O of an algorithm is the upper bounds of an algorithm and doesn't change. More specifically for selection sort who's efficiency is Θ(n^2) which means that the range of selection sort is n^2 ≥ T ≥ n^2 because the upper and lower bounds are the same.