Y
Hacker News
new
|
ask
|
show
|
jobs
by
fragmede
783 days ago
This is O(n) because you're still doing the
i < size
comparison, even though you've moved it out of the for loop.
1 comments
markisus
783 days ago
For almost all n (size), the function runs for MAX_SIZE steps, since almost all numbers are greater than MAX_SIZE. And it never runs for more than MAX_SIZE steps.
link