c# - OrderedDictionary 的复杂性是什么?

标签 c# .net performance collections

没有人说 OrderedDictionary 有两个元素副本,一个在哈希表中,另一个在列表中,我在 MSDN 上找不到 OrderedList 的复杂性度量。

谢谢

最佳答案

看看

OrderedDictionary: A generic implementation of IOrderedDictionary

This implementation of an ordered dictionary is very good at lookup operations: the array allows O(1) lookups by index, and the hashtable allows O(1) lookups by key. However, the necessity of keeping the array synchronized with the hashtable means that insert/delete operations have the performance disadvantage of performing those operations on an array (O(n) at worst). There is also, of course, the extra memory requirement of storing both data structures. Because of these disadvantages, OrderedDictionary should only be used when insert/delete operations will be minimal and there is a need to efficiently access elements by index and/or key.

关于c# - OrderedDictionary 的复杂性是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2565455/

相关文章:

ruby - require 是否应该始终位于代码的顶部(Ruby)?

c# - 如何使用 C# 返回序列化为 JSON

c# - 主线程迭代之间的资源锁定(异步/等待)

c# - 小于和大于需要在 C# 正则表达式中转义吗?

c# - GraphicsPath 和 DrawPath - 删除相交线

.NET 应用程序到 Mac OS X 应用程序?

python - 最好的高并发Python/Redis服务器

c++ - 通过引用将整数类型的变量传递给函数会比通过值更有效吗?

C# 找到带有部分键字符串的 WebCache?

.net - 没有行为的 Entity Framework POCO-需要重新设计以消除代码异味