Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4000282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:45:44+00:00 2026-05-20T07:45:44+00:00

What is the best way to represent this data structure? I’m using Objective-C for

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:45:44+00:00Added an answer on May 20, 2026 at 7:45 am

    You could use an array of arrays, that is NSArray objects that contain other NSArray objects that contain the data. The downside to this approach is that it is up to your program to enforce limits on the size of the array so that each row and column has a consistent size. If your data is static and plist-able (contains only strings, numbers, dates, data, arrays or dictionaries), consider storing it in a plist file, and loading it in one go using [NSArray arrayWithContentsOfFile:].

    If you wish to access the data using keys such as Location1, then you’ll need to use NSDictionary objects instead of NSArray objects; however doing this you lose the ability to access the data sequentially or by numerical index (it must always be accessed by key).

    Also, if your data is mutable (that is, you want to be able to alter the data), you’ll need to use NSMutableArray or NSMutableDictionary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

2 part question: 1st What is the best way to setup a table/relationship structure
I know this questions probably been used and abused.... but i keep seeing conflicting
This should be simple but I'm having trouble changing some C code that uses
I'm sure this has already been asked and answered so I apologize in advance
This is for MySQL and PHP I have a table that contains the following
I'm working on a database that needs to represent computers and their users. Each
I've been working all day and I somehow can't get this probably easy task
I am currently implementing something quite similar to checkers. So, I have this table
I am trying to import various pipe delimited files using php 5.2 into a
I have a SQL Server table with the following structure: CREATE TABLE [dbo].[Log]( [LogID]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.