In all the problems related to cyclic sort, the time complexity is mentioned as O(n) which I think is incorrect. Since, the outer loop iterates n times and for each iteration of the outer loop, we swap (say k times) until the right element is put at the correct index. Even when looking at some index which has the right element already, we spend O(1) time to check if the index and the value matches. All together, shouldn’t the time complexity be O(kn). For small values of k, I agree we can say that it is equivalent to O(n). However, if k=n/2, it is O(n^2).
So, any cyclic sort has a worst case of O(n^2) and not O(n) as mentioned.