Back to Cheat Sheets
Cheat Sheets/Big O Complexity Table
computer science

Big O Complexity Table

Time and space complexity reference

AlgorithmsComplexityCS
Time Complexity
O(1) — Constant

Array access, hash map lookup, stack push/pop

O(log n) — Logarithmic

Binary search, balanced BST operations

O(n) — Linear

Array traversal, linear search, counting

O(n log n) — Linearithmic

Merge sort, quicksort (avg), heap sort

O(n²) — Quadratic

Bubble sort, selection sort, nested loops

O(2ⁿ) — Exponential

Recursive Fibonacci, power set generation

O(n!) — Factorial

Permutations, brute force TSP

Space Complexity
O(1) — Constant

In-place algorithms, iterative solutions

O(log n) — Logarithmic

Recursive binary search (call stack)

O(n) — Linear

Hash maps, arrays, recursion depth n

O(n²) — Quadratic

2D arrays, adjacency matrix