Avatar of AlHal2
AlHal2
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Evaluating data strutures

I'm using C# in Visual Studio 2017.  I came across this page outlining the performance of different data structures.
http://bigocheatsheet.com/#data-structures
Is there an article giving use cases for each structure?  At the moment I'm just interested in common structures like arrays, lists, dictionaries, stacks and queues.
Apart from inserting, updating, deleting and viewing records, what criteria are used when evaluating different data structures for a given project?

I saw this online which partially answers my question.  If space is not an issue when would I use a list as opposed to a dictionary?
When should I use something non standard like binary trees?

The SortedDictionary<TKey, TValue> generic class is a binary search tree with O(log n) retrieval, where n is the number of elements in the dictionary. In this respect, it is similar to the SortedList<TKey, TValue> generic class. The two classes have similar object models, and both have O(log n) retrieval. Where the two classes differ is in memory use and speed of insertion and removal:

SortedList<TKey, TValue> uses less memory than  SortedDictionary<TKey, TValue>.

SortedDictionary<TKey, TValue> has faster insertion and removal operations for unsorted data: O(log n) as opposed to O(n) for  SortedList<TKey, TValue>.

If the list is populated all at once from sorted data,  SortedList<TKey, TValue> is faster than SortedDictionary<TKey, TValue>.
C#Microsoft Visual Studio

Avatar of undefined
Last Comment
AlHal2

8/22/2022 - Mon