Beruflich Dokumente
Kultur Dokumente
http://bigocheatsheet.com/
Big-O Cheat Sheet Searching Sorting Data Structures Heaps Graphs Chart Comments
1.6k
I receive
$8.00 / wk
on Gittip.
Searching
Algorithm Data Structure Time Complexity Average Graph of |V| vertices and |E| edges Graph of |V| vertices Breadth First Search (BFS) and |E| edges Sorted array of n Binary search elements Linear (Brute Force) Array Shortest path by Dijkstra, Graph with |V| vertices using a Min-heap as priority and |E| edges queue Depth First Search (DFS)
O(log(n)) O(n) O((|V| + |E|) log |V|)
Worst
O(|E| + |V|) O(|E| + |V|) O(log(n)) O(n) O((|V| + |E|) log |V|)
1 of 8
18/11/2013 11:46 AM
http://bigocheatsheet.com/
Algorithm Shortest path by Dijkstra, using an unsorted array as priority queue Shortest path by Bellman-Ford
Data Structure
Graph with |V| vertices O(|V|^2) and |E| edges Graph with |V| vertices O(|V||E|) and |E| edges
O(|V||E|)
O(|V|)
Sorting
Algorithm Data Structure Best Quicksort Mergesort Heapsort Bubble Sort Insertion Sort Select Sort Bucket Sort Radix Sort Array Array Array Array Array Array Array Array
O(n log(n)) O(n log(n)) O(n log(n)) O(n) O(n) O(n^2) O(n+k) O(nk)
Worst
O(n^2) O(n log(n)) O(n log(n)) O(n^2) O(n^2) O(n^2) O(n^2) O(nk)
Data Structures
Data Structure Indexing Basic Array Dynamic Array SinglyLinked List DoublyLinked List Skip List Hash Table
O(1) O(1)
Deletion
O(n)
Indexing
O(1) O(1)
O(n)
O(n)
O(1)
O(1)
O(n)
O(n)
O(1)
O(1)
O(n)
O(n)
O(n)
O(1)
O(1)
O(n)
O(n)
O(1)
O(1)
O(n) O(n)
O(n) O(n)
O(n) O(n)
2 of 8
18/11/2013 11:46 AM
http://bigocheatsheet.com/
Data Structure Indexing Binary Search O(log(n)) Tree Cartresian Tree B-Tree O(log(n)) Red-Black O(log(n)) Tree Splay Tree AVL Tree O(log(n)) Average Search Insertion
O(n)
O(n)
O(n)
O(n)
O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)
Heaps
Heaps Heapify Find Max Linked List (sorted) Linked List (unsorted) Binary Heap Binomial Heap Fibonacci Heap
O(n) O(1) O(n) O(1)
Delete
O(1) O(1)
Merge
O(m+n) O(1)
O(log(n))* O(1)*
Graphs
Node / Edge Management Adjacency list Incidence list Adjacency matrix Incidence matrix Storage
O(|V|+|E|) O(|V|+|E|) O(|V|^2) O(|V| |E|)
Add Vertex
O(1) O(1) O(|V|^2) O(|V| |E|)
Add Edge
O(1) O(1) O(1) O(|V| |E|)
Remove Vertex
O(|E|) O(|V|^2) O(|V| |E|)
Remove Edge
O(|E|) O(1) O(|V| |E|)
Query
O(|V|) O(|E|) O(1) O(|E|)
growth equal
[2]
3 of 8
18/11/2013 11:46 AM
http://bigocheatsheet.com/
(big omega) lower, tightness unknown greater than or equal (small omega) lower, not tight greater than [1] Big O is the upper bound, while Omega is the lower bound. Theta requires both Big O and Omega, so that's why it's referred to as a tight bound (it must be both the upper and lower bound). For example, an algorithm taking Omega(n log n) takes at least n log n time but has no upper limit. An algorithm taking Theta(n log n) is far preferential since it takes AT LEAST n log n (Omega n log n) and NO MORE THAN n log n (Big O n log n).SO [2] f(x)=(g(n)) means f (the running time of the algorithm) grows exactly like g when n (input size) gets larger. In other words, the growth rate of f(x) is asymptotically proportional to g(n). [3] Same thing. Here the growth rate is no faster than g(n). big-oh is the most useful because represents the worst-case behavior. In short, if algorithm is __ then its performance is __ algorithm performance o(n) <n O(n) n (n) =n (n) n (n) >n
Symbolic Regression
www.dtreg.com/gep.htm
4 of 8
18/11/2013 11:46 AM
http://bigocheatsheet.com/
Contributors
Edit these tables! 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Eric Rowell Quentin Pleple Nick Dizazzo Michael Abed Adam Forsyth Jay Engineer Josh Davis makosblade Alejandro Ramirez Joel Friedly Robert Burke David Dorfman Eric Lefevre-Ardant Thomas Dybdahl Ahle
5 of 8
18/11/2013 11:46 AM
http://bigocheatsheet.com/
What the Bible Says About Money (Shocking) How to Make Rich Article Pins [Cheat Sheet] How to Upgrade a PS4 Hard Drive Gallery: 20 Terrifying Trails Around The World
3 Signs You're Dangerously Close to a Heart Attack Matt Damon Won't Be Robin to Ben Affleck's Batman Tom Cruise's Reign Is Over: Katie Holmes Joins Twitter! | DAILY Surprising Way Cruise Ships Fill Their Unsold Cabins
145 comments
57
Best
Community
Share
Michael Mitchell
This is great. Maybe you could include some resources (links to khan academy, mooc etc) that would explain each of these concepts for people trying to learn them.
114
Amanda Harlin
Arjan Nieuwenhuizen
Here are the links that I know of. #1) http://aduni.org/courses/algor... #2) http://ocw.mit.edu/courses/ele... #3) https://www.udacity.com/course... probably as good or maybe better # 2, but I have not had a chance to look at it. http://ocw.mit.edu/courses/ele... Sincerely, Arjan p.s. https://www.coursera.org/cours... This course has just begun on coursera (dated 1 July 2013), and looks very
6 of 8
18/11/2013 11:46 AM
http://bigocheatsheet.com/
7 of 8
18/11/2013 11:46 AM
http://bigocheatsheet.com/
Cv Resume Format
www.Quikr.com
8 of 8
18/11/2013 11:46 AM