Big-O Cheat Sheet
Time and space complexity of data structures, sorting and graph algorithms, colour-coded and filterable.
NeweasyRuns in your browser
How it works
Big-O describes how an algorithm’s work or memory grows as the input size n grows, ignoring constants. It is an upper bound: “at most this fast-growing”.
- Best / average / worst: the cost on the luckiest input, a typical input, and the most hostile input.
- Amortised cost averages a rare expensive operation over many cheap ones (appending to a dynamic array).
- Stable sorts keep equal elements in their original order, which matters when sorting by multiple keys.
- For graphs,
Vis the number of vertices andEthe number of edges. - Colours rank growth from excellent (constant) to horrible (exponential). The complexity text is always shown, so colour is never the only signal.
- Real performance also depends on constants, cache behaviour and input shape; Big-O says how it scales, not which is faster at small n.
Related tools
CodeNew
Syntax Compare
20 languages side by side, from hello world to concurrency and GPU kernels: Python, C++, Rust, CUDA, Triton, WGSL and more.
CodeNew
Git Command Finder
Find the right git command by describing what you want to do, with danger warnings.
CodeNew
Regex Tester
Test JavaScript regular expressions live, with match highlighting, capture groups and a plain-English breakdown.