Big-O Notation
Describe how an algorithm's time or memory grows as the input size grows.
Easy
Big-O ignores constants and keeps the dominant term:
| Big-O | Name | Example |
|---|---|---|
| constant | array index, hash lookup | |
| logarithmic | binary search | |
| linear | scanning a list | |
| linearithmic | merge sort | |
| quadratic | nested loops, bubble sort | |
| exponential | brute-force subsets |
For , is about steps, while is — the difference between milliseconds and hours.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.