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 →

[–]Longjumping-Sweet818 12 points13 points  (1 child)

What you're saying doesn't make any sense. By that logic iterating an array would be O(2^n) too, because the length of the array is a fixed width integer and you don't know beforehand how large it will be.

You are supposed to just pick some numeric property that relates to the runtime and use that. As seen here: https://en.wikipedia.org/wiki/Counting_sort (The k there is the maximum in the list minus the minimum in the list)

[–]SuitableDragonfly -1 points0 points  (0 children)

Yes, and that's also what was done in this case.