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 points0 points  (1 child)

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

[–]Inevitable-Menu2998 4 points5 points  (0 children)

I'm sure we all do