Difference between SortedList and Dictionary | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Difference between SortedList and Dictionary

What difference? They have similar stucture

22nd May 2019, 12:35 PM
Игорь Стригин
Игорь Стригин - avatar
1 Answer
+ 3
Игорь Стригин If the list is populated all at once fromsorted data, SortedList(TKey, TValue)is faster than SortedDictionary(TKey, TValue). ( http://people.cs.aau.dk/~normark/oop-csharp/html/notes/collections-note-time-complexity-dictionaries.html ) Above picture shows that Dictionary<K,V> is equal or faster in every case than Sorted analog, but if order of elements is required, e.g. to print them, Sorted one is chosen. source: https://stackoverflow.com/questions/1427147/sortedlist-sorteddictionary-and-dictionary I hope I was helpful
22nd May 2019, 12:41 PM
Alessio Benvenuti
Alessio Benvenuti - avatar