Measure algorithm efficiency regardless of hardware
Big O notation describes the upper bound of an algorithm's time or space requirements as the input size (n) grows toward infinity. It abstracts away hardware differences so we can compare algorithms objectively.
O(f(n)) — "the order of f of n"
Drop constants and lower-order terms: 3n^2 + 2n + 1 = O(n^2)
Array access, Hash table lookup
Binary search, BST operations
Linear search, Array traversal
Merge sort, Heap sort
Bubble sort, Nested loops
Recursive Fibonacci, Subset sum
How the number of operations scales with input size n. Measures CPU cost. Focus: number of comparisons, iterations, recursive calls.
How much extra memory an algorithm uses relative to input size n. Includes stack frames for recursion, auxiliary data structures.