什么是OrderedDictionary的复杂? [英] What is the complexity of OrderedDictionary?

查看:221
本文介绍了什么是OrderedDictionary的复杂?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有人说OrderedDictionary是有两个副本的元素,一个在哈希表和其他列表中,我无法找到的复杂测量,在MSDN的OrderedList。

No one said that OrderedDictionary is having two copies of elements, one in a hashtable and other in a list, I can't find complexity measurements at MSDN for OrderedList.

感谢

推荐答案

看一看

<一个href="http://www.$c$cproject.com/KB/recipes/GenericOrderedDictionary.aspx?msg=2016376">OrderedDictionary:一个普通的实施IOrderedDictionary 的

本实施有序   词典是非常善于查找   操作:将阵列允许O(1)   通过查找索引和哈希表   允许O(1)通过查找键。然而,   保持阵列的必要性   与哈希表的手段同步   即插入/删除操作有   表演的性能劣势   在一个阵列(O(N那些操作)的   最差)。也有,当然,在   存储额外的内存要求   二者的数据结构。由于这些   缺点,OrderedDictionary   只应使用时插入/删除   操作将是最小的有   必要有效地访问   通过索引和/或关键要素。

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.

这篇关于什么是OrderedDictionary的复杂?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆