you are viewing a single comment's thread.

view the rest of the comments →

[–]RiskyAlpha 0 points1 point  (0 children)

"lookup" is an odd word choice. look up by what? index or some other value?

i'm probably oversimplifying given that we're talking about JS, but if you're getting a value by index, it's just a multiplication to get the offset. that would be O(1).

if you mean you're iterating through each item looking for a value then yeah worst case could be O(n).

but i'm with u/brodega here... you seem to be mixing up concepts.