What is the best way to represent this data structure? I'm using Objective-C for iPhone development but just generally is fine.
Location1 Location2 Location3
Location1 0 8 23
Location2 8 0 16
Location3 23 16 0
I could do nested arrays...
table = ['Location1' => ['Location 1' => '0',
'Location 2' => '8',
'Location 3' => '23'],
'Location2' => ['Location 1' => '8',
'Location 2' => '0',
'Location 3' => '16'],
'Location3' => ['Location 1' => '23',
'Location 2' => '16',
'Location 3' => '0']]
... 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?
Additionally, are there any special iPhone Objective-C data structures that would lend themselves to this kind of data?