title: How to represent tabular data in Objective-C
body: <p>What is the best way to represent this data structure? I'm using Objective-C for iPhone development but just generally is fine.</p>
  
  <pre><code>             Location1          Location2         Location3
  Location1        0                  8                 23
  Location2        8                  0                 16
  Location3        23                 16                0
  </code></pre>
  
  <p>I could do nested arrays...</p>
  
  <pre><code>table = ['Location1' =&gt; ['Location 1' =&gt; '0',
                           'Location 2' =&gt; '8',
                           'Location 3' =&gt; '23'],
           'Location2' =&gt; ['Location 1' =&gt; '8',
                           'Location 2' =&gt; '0',
                           'Location 3' =&gt; '16'],
           'Location3' =&gt; ['Location 1' =&gt; '23',
                           'Location 2' =&gt; '16',
                           'Location 3' =&gt; '0']]
  </code></pre>
  
  <p>... but I'm not sure this is the most efficient way as there's a lot of data replication. Maybe some sort of object-oriented method?</p>
  
  <p>Additionally, are there any special iPhone Objective-C data structures that would lend themselves to this kind of data?</p>