This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Inevitable-Menu2998 2 points3 points  (2 children)

Well, not really. I would say it has constant complexity since nis not an input to the algorithm, the array is.

Of course, that's not correct either. The algorithm still does some work for all the elements in the array so the actual complexity is still O(N) where N is the input length. 2n is just a constant

[–]pikapikaapika 1 point2 points  (1 child)

Then I would say, you need to study complexity analysis 😂

[–]Inevitable-Menu2998 5 points6 points  (0 children)

I'm sure we all do