According to this website: http://bigocheatsheet.com/ Accessing an array is constant time but searching it is O(n). What's the difference between accessing an array and searching it?
Accesing means looking up an item value by index, while searching means looking up an index by item value. Obviously an array lookup is constant, while linear searching is, well.. linear.
Accessing means using the value a[i]. Searching means finding the i you want.
For example, where in this answer is the last letter E? You have to look at every letter in my answer, because I might have written EEEEEEE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With