Complexity Cheatsheet
Visual comparison of Big-O growth rates and per-algorithm complexities.
Algorithm Complexities
| Algorithm | Category | Time Complexity |
|---|---|---|
| Breadth-First Search | Pathfinding | O(V + E) |
| Depth-First Search | Pathfinding | O(V + E) |
| Dijkstra Algorithm | Pathfinding | O(V + E log V) |
| A* Search | Pathfinding | O(V + E log V) |
| Bubble Sort | Sorting | O(n²) |
| Insertion Sort | Sorting | O(n²) |
| Selection Sort | Sorting | O(n²) |
| Quick Sort | Sorting | O(n log n) |
| Merge Sort | Sorting | O(n log n) |
| Heap Sort | Sorting | O(n log n) |
| Shell Sort | Sorting | O(n log²n) |
| Radix Sort | Sorting | O(nk) |
| Bogo Sort | Sorting | O((n+1)!) |
| Linear Search | Searching | O(n) |
| Binary Search | Searching | O(log n) |
| Sliding Window (Fixed) | Two Pointers | O(n) |
| Sliding Window (Variable) | Two Pointers | O(n) |
| Fast & Slow | Two Pointers | O(n) |
| Stack (LIFO) | Stacks & Queues | O(1) |
| Queue (FIFO) | Stacks & Queues | O(1) |
| Hash Map | Hash Map & Set | O(1) avg |
| Binary Search Tree | Trees & Heaps | O(log n) avg |
| Heap / Priority Queue | Trees & Heaps | O(log n) |
| Graph Traversal | Graphs | O(V + E) |
| Fibonacci | Dynamic Programming | O(n) |
| N-Queens | Backtracking | O(n!) |