Hi all,
As a small part of a project I am currently working on, I need some way to do the following.
Keep adding new entries to a list, each of these new entries has an identity (double number) unique to itself. The list needs to be variable in size so an array is out of the question (I don't want to bodge it by making a massive array and hoping its OK - unless this is the best option in your opinions).
I only want each identity to have 3 entries in the list, any more and I don't want them added. The most important aspect of this is that it is fast and low on memory requirements.
Here are my ideas on how to implement:
1) Use a hash table - no good as this requires a set size of the list from the beginning.
2) Use a linked list where each element contains an array of 3 containing the details of each entry with the same identity.
I think the linked list idea (2) is the only way of doing it due to the variable size, but this means that each time I want to add a new entry to the list I have to search through the whole list to check for previous identical entries - unlike the hash table where I can key straight to it.
Basically, I would like some advice on what's the best option, or if there's a better way of doing this?
Thank you all for your time,
Ben