码迷,mamicode.com
首页 > 其他好文 > 详细

[ZZ]常用数据结构及复杂度

时间:2016-06-11 11:42:37      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:

http://www.cnblogs.com/gaochundong/p/3813252.html

常用数据结构的时间复杂度

Data Structure

Add

Find

Delete

GetByIndex

 Array (T[])

O(n)

O(n)

O(n)

O(1)

 Linked list (LinkedList<T>)

O(1)

O(n)

O(n)

O(n)

 Resizable array list (List<T>)

O(1)

O(n)

O(n)

O(1)

 Stack (Stack<T>)

O(1)

-

O(1)

-

 Queue (Queue<T>)

O(1)

-

O(1)

-

 Hash table (Dictionary<K,T>)

O(1)

O(1)

O(1)

-

 Tree-based dictionary

 (SortedDictionary<K,T>)

  O(log n)  

  O(log n)  

  O(log n)  

-

 Hash table based set

 (HashSet<T>)

O(1)

O(1)

O(1)

-

 Tree based set

 (SortedSet<T>)

O(log n)

O(log n)

O(log n)

-

[ZZ]常用数据结构及复杂度

标签:

原文地址:http://www.cnblogs.com/pegasus923/p/5574833.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!