educative.io

Shouldn't the time complexity be O(Max(n, k0)?

Shouldn’t the time complexity be O(Max(n, k)) ? We loop n times to find missing numbers after cyclic sort. And if k > n, then we do k - n loops. So the worst case should be O(Max(n,k)), right?


Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/4513413935923200