Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wouldn’t searching for an element in an arbitrary array of size n happen in O(n) time, while only accessing it is considered O(1)? I could understand the search case for something like a hash table being O(1) but does that also apply to your standard array?


Ah, I misspoke. I meant "access", you're correct about searching. The original link I cited for explanation still applies.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: