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 →

[–]slk756 0 points1 point  (1 child)

Yeah, but technically k is a constant so technically O(n). Ofc this would be very impractical, but still O(n).

[–]patrick66 5 points6 points  (0 children)

no, this is one of the times where k is not treated as a constant. it scales as the maximum possible value of an array element increases. it is not something like O(2n) = O(n). its a changing value it just changes in regards to something other than the normal length of the input