Exercises on most common used data structures in programming
Data Structure Efficiency | ||||
---|---|---|---|---|
Data structure | Add | Find | Delete | Get by Index |
Array T [] | 0(n) | 0(n) | 0(n) | 0(1) |
List<T> | 0(1) | 0(n) | 0(n) | 0(1) |
LinkedList<T> | 0(1) | 0(n) | 0(n) | 0(n) |
Stack<T> | 0(1) | - | 0(1) | - |
Queue<T> | 0(1) | - | 0(1) | - |
Dictionary<K,V> | 0(1) | 0(1) | 0(1) | - |
SortedDictionary<K,V> | 0(log N) | 0(log N) | 0(log N) | - |
MultiDictionary<K,V> | 0(1) | 0(1) | 0(1) | - |
SortedMultiDictionary<K,V> | 0(log N) | 0(log N) | 0(log N) | - |
HashSet<T> | 0(1) | 0(1) | 0(1) | - |
SortedSet<T> | 0(log N) | 0(log N) | 0(log N) | - |
Bag<T> | 0(1) | 0(1) | 0(1) | - |
OrderedBag<T> | 0(log N) | 0(log N) | 0(log N) | - |