アルゴリズム複雑度まとめ!
ちょうど1つのとても良いアルゴリズムの複雑さの総括する貼ることを見て、思い切って回転しました。
原文のリンク:http://bigocheatsheet.com/#
お父さん、これらの表は完全に表示することができなくて、みんなは上のリンクをつけて原文を見ることができます。
Searching
Algorithm
Data Structure
Time Coplexity
Space Coplexity
Average
World
World
Depth First Search(DFS)
Graph of|V𞓜vertices and|E edges
Graph of|V𞓜vertices and|E edges
Sorted array of n elemens
Aray
Graph with|V vertices and𞓜E edges
Graph with|V vertices and𞓜E edges
Graph with|V vertices and𞓜E edges
Algorithm
Data Structure
Time Coplexity
Word Case Auxiliary Space Coplexity
ベスト
Average
World
World
Quicksort
Aray
Aray
Aray
Aray
Aray
Aray
Aray
Aray
Data Structure
Time Coplexity
Space Coplexity
Average
World
World
Indexing
Search
Insertion
Deletion
Indexing
Search
Insertion
Deletion
Baic Aray
Heapps
Time Coplexity
Heappify
Find Max
Extract Max
Increase Key
インセンス
Delete
Merge
Linked List(sorted)
Node/Edge Management
Strage
Add Vetex
Add Edge
Remove Vetex
Remove Edge
Query
Adjacency list
letter
bound
growth
(theta)Θ
uper and lower,tight[1]
equal[2]
(big-oh)O
up per,tightnes unknown
less than or equal[3]
(small-oh)o
スーパー、not tight
less than
(big omega)Ω
lower,tightnes unknown
greater than or equal
(small omega)ω
lower,not tight
greater than
[1]Big O is the up per bound,while Omega is the lower bound.Thtarequires both Big O and Omega、so that's why its referred to a s a tightbound(itmusst be both the uup per and lowewer lowewewer bobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobod.TaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTale le InInInInInInInInInInInInInInInInInInInInInInInInInInInInInInInalgorithm tang Thta(n logn)is far preferential since it taes AT LEAST n logn(Omega n logn)and NO MORE THAN n logn(Big O n logn).SO
[2]f(x)=Θ(g(n)means f(the running time of the algorithm)grows exactly like g when(input size)gets larger.In other wods,the growth rate of f(x)is asymptotical proporation to g(n.)
[3]Same thing.Here the growth rate isのfaster than g(n).big-oh is the most useful because represents the wost-case behavior.
Inショート、if algorithm is_uthen its performance is_u
algorithm
performance
o(n)
O(n)
≦n
Θ(n)
=n
Ω(n)
≧n
ω(n)
>n
を選択します
Big-O Coplexity Chart
Conttribute Edit these tables!
Authors:エリックRowell Quentin Pleple Nick Dizzo Michael Abed Adam Forsyth Jay Engeer Josh Davis makos blade Alejandro Ramirez Joel Fridly Robert Burke David Durfman Erric Lefevre-Ardant トーマスDybadahl Ahle
原文のリンク:http://bigocheatsheet.com/#
お父さん、これらの表は完全に表示することができなくて、みんなは上のリンクをつけて原文を見ることができます。
Searching
Algorithm
Data Structure
Time Coplexity
Space Coplexity
Average
World
World
Depth First Search(DFS)
Graph of|V𞓜vertices and|E edges
-
O(|E| + |V|)
O(|V|)
Breadth First Search(BFS)Graph of|V𞓜vertices and|E edges
-
O(|E| + |V|)
O(|V|)
Binary searchSorted array of n elemens
O(log(n))
O(log(n))
O(1)
Linear(Brute Force)Aray
O(n)
O(n)
O(1)
Shotest path by Dijkstra、using a Min-heap as priority queueGraph with|V vertices and𞓜E edges
O((|V| + |E|) log |V|)
O((|V| + |E|) log |V|)
O(|V|)
Shotest path by Dijkstra、using an unsorted array as prorit queueGraph with|V vertices and𞓜E edges
O(|V|^2)
O(|V|^2)
O(|V|)
Shotest path by Bellman-FordGraph with|V vertices and𞓜E edges
O(|V||E|)
O(|V||E|)
O(|V|)
SortingAlgorithm
Data Structure
Time Coplexity
Word Case Auxiliary Space Coplexity
ベスト
Average
World
World
Quicksort
Aray
O(n log(n))
O(n log(n))
O(n^2)
O(n)
MergsortAray
O(n log(n))
O(n log(n))
O(n log(n))
O(n)
HeappsortAray
O(n log(n))
O(n log(n))
O(n log(n))
O(1)
Bbble SortAray
O(n)
O(n^2)
O(n^2)
O(1)
インセプション?ソートAray
O(n)
O(n^2)
O(n^2)
O(1)
Select SortAray
O(n^2)
O(n^2)
O(n^2)
O(1)
Butet SortAray
O(n+k)
O(n+k)
O(n^2)
O(nk)
Radix SortAray
O(nk)
O(nk)
O(nk)
O(n+k)
Data StructuresData Structure
Time Coplexity
Space Coplexity
Average
World
World
Indexing
Search
Insertion
Deletion
Indexing
Search
Insertion
Deletion
Baic Aray
O(1)
O(n)
-
-
O(1)
O(n)
-
-
O(n)
Dynamic ArayO(1)
O(n)
O(n)
O(n)
O(1)
O(n)
O(n)
O(n)
O(n)
Singly-linked ListO(n)
O(n)
O(1)
O(1)
O(n)
O(n)
O(1)
O(1)
O(n)
Doubly-linked ListO(n)
O(n)
O(1)
O(1)
O(n)
O(n)
O(1)
O(1)
O(n)
スキップリストO(log(n))
O(log(n))
O(log(n))
O(log(n))
O(n)
O(n)
O(n)
O(n)
O(n log(n))
Hash Table-
O(1)
O(1)
O(1)
-
O(n)
O(n)
O(n)
O(n)
Binary Search TreeO(log(n))
O(log(n))
O(log(n))
O(log(n))
O(n)
O(n)
O(n)
O(n)
O(n)
Catresian Tree-
O(log(n))
O(log(n))
O(log(n))
-
O(n)
O(n)
O(n)
O(n)
B-TreeO(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)
Red-Black TreeO(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)
Splay Tree-
O(log(n))
O(log(n))
O(log(n))
-
O(log(n))
O(log(n))
O(log(n))
O(n)
AVL TreeO(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)
HeappsHeapps
Time Coplexity
Heappify
Find Max
Extract Max
Increase Key
インセンス
Delete
Merge
Linked List(sorted)
-
O(1)
O(1)
O(n)
O(n)
O(1)
O(m+n)
Linked List(unsorted)-
O(n)
O(n)
O(1)
O(1)
O(1)
O(1)
Binary HeapO(n)
O(1)
O(log(n))
O(log(n))
O(log(n))
O(log(n))
O(m+n)
Binomial Heap-
O(log(n))
O(log(n))
O(log(n))
O(log(n))
O(log(n))
O(log(n))
Fibonacci Heap-
O(1)
O(log(n))*
O(1)*
O(1)
O(log(n))*
O(1)
GraphsNode/Edge Management
Strage
Add Vetex
Add Edge
Remove Vetex
Remove Edge
Query
Adjacency list
O(|V|+|E|)
O(1)
O(1)
O(|V| + |E|)
O(|E|)
O(|V|)
Incidence listO(|V|+|E|)
O(1)
O(1)
O(|E|)
O(|E|)
O(|E|)
Adjacency matrixO(|V|^2)
O(|V|^2)
O(1)
O(|V|^2)
O(1)
O(1)
Incidence matrixO(|V| ⋅ |E|)
O(|V| ⋅ |E|)
O(|V| ⋅ |E|)
O(|V| ⋅ |E|)
O(|V| ⋅ |E|)
O(|E|)
Notation for asymptotic growthletter
bound
growth
(theta)Θ
uper and lower,tight[1]
equal[2]
(big-oh)O
up per,tightnes unknown
less than or equal[3]
(small-oh)o
スーパー、not tight
less than
(big omega)Ω
lower,tightnes unknown
greater than or equal
(small omega)ω
lower,not tight
greater than
[1]Big O is the up per bound,while Omega is the lower bound.Thtarequires both Big O and Omega、so that's why its referred to a s a tightbound(itmusst be both the uup per and lowewer lowewewer bobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobobod.TaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTaTale le InInInInInInInInInInInInInInInInInInInInInInInInInInInInInInInalgorithm tang Thta(n logn)is far preferential since it taes AT LEAST n logn(Omega n logn)and NO MORE THAN n logn(Big O n logn).SO
[2]f(x)=Θ(g(n)means f(the running time of the algorithm)grows exactly like g when(input size)gets larger.In other wods,the growth rate of f(x)is asymptotical proporation to g(n.)
[3]Same thing.Here the growth rate isのfaster than g(n).big-oh is the most useful because represents the wost-case behavior.
Inショート、if algorithm is_uthen its performance is_u
algorithm
performance
o(n)
≦n
Θ(n)
=n
Ω(n)
≧n
ω(n)
>n
を選択します
Big-O Coplexity Chart
Conttribute Edit these tables!
Authors: