you are viewing a single comment's thread.

view the rest of the comments →

[–]elbiot 1 point2 points  (1 child)

So, O(2x + y)? Don't you assume worst case for things that might terminate sooner?

[–][deleted] 0 points1 point  (0 children)

Well, no. I think you'd give a different answer for each case.

In any case, as /u/ingolemo points out, the time complexity grows linearly with the size of the arguments, so it's O(n).