我想了解 ConcurrentDictionary
的计算复杂性vers SortedList
(即 O(logarithmic(n))
),ConcurrentDictionary 只是 SortedList
的并发同步实现吗?还是这些数据结构有所不同?彼此之间?
最佳答案
ConcurrentDictionary<T,U>
是 Dictionary<T,U>
的并发版本.它不像 SortedList<T,U>
那样按键排序.复杂度与Dictionary<T,U>
密切相关的复杂性,因此获取方法为 O(1)。
SortedList<T,U>
大多数获取操作的复杂度为 O(log n),因为它遍历内部排序结构。
关于c# - ConcurrentDictionary 是 SortedList 的 "concurrent"版本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15511394/