title: How are arrays and hash maps constant time in their access?
body: <p>Specifically: given a hash (or an array index), how does the machine get to the data in constant time?</p>
  
  <p>It seems to me that even passing by all the other memory locations (or whatever) would take an amount of time equal to the number of locations passed (so linear time). A coworker has tried valiantly to explain this to me but had to give up when we got down to circuits. </p>
  
  <p>Example: </p>
  
  <pre><code>my_array = new array(:size =&gt; 20)
  my_array[20] = "foo"
  my_array[20] # "foo"
  </code></pre>
  
  <p>Access of "foo" in position 20 is constant because we know which bucket "foo" is in. How did we magically get to that bucket without passing all the others on the way? To get to house #20 on a block you would still have to pass by the other 19...</p>