Insertion Sort
Best Case: O(n)
Worst Case: O(n^2)
Average: O(n^2 / 2)
Selection Sort
O(n^2 / 2)
Merge Sort
O(n log n)
Quick Sort
O(n log n)
Heap Sort
O(n log n)
Sequential Search
O(n/2)
Binary Search
O(log n)
Binary Search Tree
Worst Case: O(n)
Average: O(1.39 log n)
Red-Black Search Tree
O(log n)
Depth-First Search
O(E)
Breadth-First Search
O(V+E)
Prim’s MST Algorithm
O(E log E)
Kruskal’s MST Algorithm
O(E log E)
Dijkstra’s Shortest-Path Algorithm
O(E log V)
Longest Path in DAG
O(E + V)
Bellman-Ford
O(EV)
Ford-Fulkerson
O(VE^2 / 2)
Stable Matching
O(n^2)
A*
Roughly same as Dijkstra’s, though slightly better: O(E log V)
Memoization
Saving values that have already been calculated - part of dynamic programming