title: Temporal vs Spatial Locality with arrays
body: <p>I am a little confused on the meanings of spatial and temporal locality. I'm hoping by looking at it with an array example it will help me understand it better.</p>
  
  <p>In an example like this:
  A[0][1], A[0][2], A[0][3].... etc</p>
  
  <p>Does this demonstrate temporal locality? I see the same row is accessed many times but at different offsets... does this mean a different address is accessed?</p>
  
  <p>Also, am I correct in saying that an example like this:
  A[1], A[2], A[3]... etc</p>
  
  <p>Demonstrates spatial locality?</p>
  
  <p>Hopefully some clarification on how temporal and spatial locality work in real code will help me better understand them.</p>