Time — Best to Worst
O(1)Constant — hash lookup, array access
O(log n)Logarithmic — binary search, balanced BST
O(n)Linear — single loop, two pointers
O(n log n)Linearithmic — merge sort, heap sort
O(n²)Quadratic — nested loops, bubble sort
O(2ⁿ)Exponential — backtracking, subsets
O(n!)Factorial — all permutations
Space Patterns
O(1)In-place, no extra structures
O(n)Hash map, stack, queue, dp array
O(n²)2D DP table, adjacency matrix
O(log n)Recursion stack — binary search
O(h)Tree height — DFS call stack