Time complexity

why time complexity is O(N + range)

Counting sort in not a comparison based sorting. So while building the output sorted array…you do not need to iterate through the whole unsorted input array is is Bubble sort or Selection sort . This is why the counting sort has a linear time complexity.
Refer this for more detail:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.