I would like to understand the Computational Complexity of a ConcurrentDictionary
vers SortedList
(Which is O(logarithmic(n))
), is a ConcurrentDictionary just a concurrent synchronized implementation of a SortedList
? or do these data structures vary? among one another?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
ConcurrentDictionary<T,U>
is a concurrent version of aDictionary<T,U>
. It does not sort by keys like aSortedList<T,U>
. The complexity is closely related to aDictionary<T,U>
's complexity, so fetches approach O(1).SortedList<T,U>
has O(log n) complexity for most fetch operations since it's walking the internal sorted structure.I believe that
ConcurrentDictionary<K,V>
is a thread-safe analog ofDictionary<K,V>
and both should have complexity O(1). They don't provide key sorting, order is not guaranteed.