views:

158

answers:

3

I was just wondering what do you guys think would be the best c# data structure for problem like this.

So I will have an array of keys, and for each key array of arrays. Sounds complicated does it :)

Anyway the simplest solution that comes to my mind, note that I never did any formal c# training. It was more I am C++ programmer and then for some stupid project did C# application. Therefore I might have missed out on a good structure I could use.

So

Dictionary<string, List<Dictionary<string, double>>
is what I had in mind. But is there anything better?

I will have set of data points for each key, but more than one set of data points.

So I was just wondering if anyone has better design suggestion.

Cheers

+1  A: 

Sounds like you might want to create a custom object to encapsulate your datapoint, then store that in a dictionary keyed by whatever value makes sense.

From what you've said, the object you store as the value in the dictionary, might itself be a collection of datapoints.

So you might create an object which encapsulates your List<Dictionary<string, double>>

Winston Smith
A: 

I assume that since you are using some sort of key to access the internal arrays, that you don't intend to just loop through the data object and pull out every value. If that is the case then you are right, a Dictionary is probably your best choice.

Zensar
A: 

There is good data structure: Trie(http://en.wikipedia.org/wiki/Trie). For our c# project we have used TopCoder implementation.

Dewfy