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

时间:2016-06-11 11:41:51   收藏:0   阅读:248

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)

-

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!