Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
fragmede
2y ago
0 comments
Save
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
1 comments · 1 top-level
top
newest
oldest
markisus
2y 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