Sie sind auf Seite 1von 3

Key

Good Fair Poor

DataStructures
Space
DataStructure TimeComplexity Complexity

Average Worst Worst

Indexing Search Insertion Deletion Indexing Search Insertion Deletion

BasicArray(Array) O(1) O(n) O(1) O(n) O(n)

DynamicArray(List<T>
O(1) O(n) O(n) O(n) O(1) O(n) O(n) O(n) O(n)
andArrayList)

SinglyLinkedList O(n) O(n) O(1) O(1) O(n) O(n) O(1) O(1) O(n)

DoublyLinkedList
O(n) O(n) O(1) O(1) O(n) O(n) O(1) O(1) O(n)
(LinkedList<T>)

SkipList O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(n) O(n) O(n) O(nlog(n))

HashTable(HashSet<T>
Dictionary<TKey,TValue> O(1) O(1) O(1) O(n) O(n) O(n) O(n)
andHashtable)

BinarySearchTree
(SortedDictionary<TKey, O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(n) O(n) O(n) O(n)
TValue>)

SortedArrayusingBinary
Search(SortedList<TKey, O(log(n)) O(?) O(1) O(1) O(log(n)) O(?) O(n) O(n) O(?)
TValue>)

CartesianTree O(log(n)) O(log(n)) O(log(n)) O(n) O(n) O(n) O(n)

SplayTree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)

RedBlackTree
(SortedSet<T>No O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)
Duplicates)

AVLTree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)

BTree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)

Searching
Space
Algorithm DataStructure TimeComplexity Complexity

Average Worst Worst

DepthFirstSearch(DFS) Graphof|V|verticesand|E|
O(|E|+|V|) O(|V|)
edges

BreadthFirstSearch(BFS) Graphof|V|verticesand|E|
O(|E|+|V|) O(|V|)
edges

Binarysearch(Array.BinarySearchor
Sortedarrayofnelements O(log(n)) O(log(n)) O(1)
List<T>.BinarySearch)
Linear(BruteForce) Array O(n) O(n) O(1)

ShortestpathbyDijkstra, Graphwith|V|verticesand O((|V|+|E|) O((|V|+|E|)


O(|V|)
usingaMinheapaspriorityqueue |E|edges log|V|) log|V|)

ShortestpathbyDijkstra, Graphwith|V|verticesand
O(|V|^2) O(|V|^2) O(|V|)
usinganunsortedarrayaspriorityqueue |E|edges

ShortestpathbyBellmanFord Graphwith|V|verticesand
O(|V||E|) O(|V||E|) O(|V|)
|E|edges

Sorting
Data WorstCaseAuxiliary
Algorithm Structure TimeComplexity SpaceComplexity

Best Average Worst Worst

Quicksort(Array.SortandList<T>.Sortand O(n O(n


Array O(n^2) O(n)
Enumerable.OrderBy<TSource,TKey>) log(n)) log(n))

Mergesort O(n O(n O(n


Array O(n)
log(n)) log(n)) log(n))

Heapsort O(n O(n O(n


Array O(1)
log(n)) log(n)) log(n))

BubbleSort Array O(n) O(n^2) O(n^2) O(1)

InsertionSort Array O(n) O(n^2) O(n^2) O(1)

SelectSort Array O(n^2) O(n^2) O(n^2) O(1)

BucketSort Array O(n+k) O(n+k) O(n^2) O(nk)

RadixSort Array O(nk) O(nk) O(nk) O(n+k)

Heaps
Heaps TimeComplexity

Heapify FindMax ExtractMax IncreaseKey Insert Delete Merge

LinkedList(sorted) O(1) O(1) O(n) O(n) O(1) O(m+n)

LinkedList(unsorted) O(n) O(n) O(1) O(1) O(1) O(1)

BinaryHeap O(n) O(1) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(m+n)

BinomialHeap O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n))

FibonacciHeap O(1) O(log(n))* O(1)* O(1) O(log(n))* O(1)

Graphs
Node/EdgeManagement Storage AddVertex AddEdge RemoveVertex RemoveEdge Query

Adjacencylist O(|V|+|E|) O(1) O(1) O(|V|+|E|) O(|E|) O(|V|)

Incidencelist O(|V|+|E|) O(1) O(1) O(|E|) O(|E|) O(|E|)

Adjacencymatrix O(|V|^2) O(|V|^2) O(1) O(|V|^2) O(1) O(1)

Incidencematrix O(|V||E|) O(|V||E|) O(|V||E|) O(|V||E|) O(|V||E|) O(|E|)


BigOComplexityChart

Das könnte Ihnen auch gefallen