sorteddictionary

Is SortedDictionary a red-black tree?

徘徊边缘 提交于 2019-11-29 03:32:39
I saw several quotes about this on the Internet but no official documentation? Can anyone tell me where I can get information about this? This isn’t supposed to be documented since it’s an implementation detail . For instance, there is more than one implementation of SortedDictionary : there’s Microsoft’s and there’s the Mono implementation. And the Mono implementation does, in fact, use a red-black tree in its current version (2.10.9). So does the current .NET version (you can find that out by decompiling the code, for instance by using Reflector , ildasm.exe or the built-in IL viewer in

SortedList<>, SortedDictionary<> and Dictionary<>

半世苍凉 提交于 2019-11-27 10:46:32
I find that SortedList<TKey, TValue> SortedDictionary<TKey, TValue> and Dictionary<TKey, TValue> implement the same interfaces. When should we opt for SortedList and SortedDictionary over Dictionary ? What is the difference between SortedList and SortedDictionary in terms of application? Szymon Rozga When iterating over the elements in either of the two, the elements will be sorted. Not so with Dictionary<T,V> . MSDN addresses the difference between SortedList<T,V> and SortedDictionary<T,V> : The SortedDictionary(TKey, TValue) generic class is a binary search tree with O(log n) retrieval,

When to use a SortedList<TKey, TValue> over a SortedDictionary<TKey, TValue>?

旧时模样 提交于 2019-11-27 00:44:31
This may appear to be a duplicate of this question , which asks "What’s the difference between SortedList and SortedDictionary ?" Unfortunately, the answers do nothing more than quote the MSDN documentation (which clearly states that there are performance and memory use differences between the two) but don't actually answer the question. In fact (and so this question doesn't get the same answers), according to MSDN: The SortedList<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, it is similar to the

SortedList<>, SortedDictionary<> and Dictionary<>

大憨熊 提交于 2019-11-26 11:58:11
问题 I find that SortedList<TKey, TValue> SortedDictionary<TKey, TValue> and Dictionary<TKey, TValue> implement the same interfaces. When should we opt for SortedList and SortedDictionary over Dictionary ? What is the difference between SortedList and SortedDictionary in terms of application? 回答1: When iterating over the elements in either of the two, the elements will be sorted. Not so with Dictionary<T,V> . MSDN addresses the difference between SortedList<T,V> and SortedDictionary<T,V> : The

When to use a SortedList<TKey, TValue> over a SortedDictionary<TKey, TValue>?

白昼怎懂夜的黑 提交于 2019-11-26 09:26:45
问题 This may appear to be a duplicate of this question, which asks \"What’s the difference between SortedList and SortedDictionary?\" Unfortunately, the answers do nothing more than quote the MSDN documentation (which clearly states that there are performance and memory use differences between the two) but don\'t actually answer the question. In fact (and so this question doesn\'t get the same answers), according to MSDN: The SortedList<TKey, TValue> generic class is a binary search tree with O

What&#39;s the difference between SortedList and SortedDictionary?

落爺英雄遲暮 提交于 2019-11-26 06:06:43
Is there any real practical difference between a SortedList<TKey,TValue> and a SortedDictionary<TKey,TValue> ? Are there any circumstances where you would specifically use one and not the other? Yes - their performance characteristics differ significantly. It would probably be better to call them SortedList and SortedTree as that reflects the implementation more closely. Look at the MSDN docs for each of them ( SortedList , SortedDictionary ) for details of the performance for different operations in different situtations. Here's a nice summary (from the SortedDictionary docs): The