Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
fragmede
1y ago
0 comments
Share
This is O(n) because you're still doing the
i < size
comparison, even though you've moved it out of the for loop.
0 comments
default
newest
oldest
markisus
1y 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.
j
/
k
navigate · click thread line to collapse