What data structures can efficiently store 2-d “grid” data?
Here are a few approaches. I’ll (try to) illustrate these examples with a representation of a 3×3 grid. The flat array +—+—+—+—+—+—+—+—+—+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | +—+—+—+—+—+—+—+—+—+ a[row*width + column] To access elements on the left or right, subtract or … Read more