Check the time complexity

I have submitted the code for this challenge - “Sorting in Linear Time”. Can you review its time complexity ?

Although, the submitted code got passed successfully … but i have doubt its having space complexity of O(2n).

hey @kakkarhk Since your program is having two separate for loops Each having worst no. of iterations as n. Therefore Time complexity = n + n = 2n,
But as we only take into account the order i.e. power of n.Therefore the time complexity of this program will be O(n).

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.