I am learning Ruby through the canonical pickaxe book. In Section 2.3 of that book, I came across a sentence saying that,
It’s more efficient to access array elements, but hashes provide more flexibility
As I understand, accessing array elements and looking up hash values by key both take O(1) time.
What does the author mean, when he says that arrays are more efficient for access? Does it simply mean that array is more efficient, because the internal representation of an array is simpler than a hash?