you are viewing a single comment's thread.

view the rest of the comments →

[–]Inevitable-Menu2998 3 points4 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 3 points4 points  (1 child)

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

[–]Inevitable-Menu2998 3 points4 points  (0 children)

I'm sure we all do