首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SortedList<TKey,TValue> 和 SortedDictionary<TKey,TValue>

SortedList<TKey,TValue> 和 SortedDictionary<TKey,TValue>

作者头像
用户1172223
发布2018-01-26 14:56:22
5350
发布2018-01-26 14:56:22
举报
文章被收录于专栏:哲学驱动设计哲学驱动设计

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 SortedDictionary<TKey, TValue> generic class. The two classes have similar object models, and both have O(log n) retrieval. Where the two classes differ is in memory use and speed of insertion and removal:

  • 1.SortedList<TKey, TValue> uses less memory than SortedDictionary<TKey, TValue>.
  • 2.SortedDictionary<TKey, TValue> has faster insertion and removal operations for unsorted data, O(log n) as opposed to O(n) for SortedList<TKey, TValue>.
  • 3.If the list is populated all at once from sorted data, SortedList<TKey, TValue> is faster than SortedDictionary<TKey, TValue>.
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2009-12-18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档