• Advertisement
Sign in to follow this  

Data storage

This topic is 2859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well this isn't a really specific language question, but rather a generic "programming" question.. Let's say I have 3 independent fields: "name" "phone number" and "age".. Now I would like to store these in such a way I can find them most easily: -most of the time I want to retrieve "age groups". (and get the list of names/phone numbers). -However sometimes a certain "name" would like to change its "data" Is there any data structure that might work for such a thing? (binary trees, sorted by age are my best guess. - but then how would I search for "age between x and y")

Share this post


Link to post
Share on other sites
Advertisement
In a RDB, you'd have a table with those 3 columns, and then you'd tell it to be indexed by age and name, so you can quickly retrieve data using those columns as a lookup.

In any programming language with arrays, you can do the same thing.
You make an array of name/phone/age, then you make an array of indices into the first array which is sorted by age, and an array of indices sorted by name.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement