- O(1): constant time – the same regardless of input size
- O(log n): logarithmic – halving work each step, great for search
- O(n): linear – direct relationship, straightforward implementation
- O(n log n): near-linear – typical for efficient sorting
- O(n^2): quadratic – nested loops can cause steep slowdowns
- Use test inputs of varying sizes to confirm patterns.
- Track CPU cycles or memory usage for concrete benchmarks.
- Consult established references when unsure about hidden constants.
- Simplify by focusing on growth rather than exact counts.
- Assuming constants affect big o values; they do not.
- Ignoring auxiliary space, which may also matter in constrained environments.
- Overlooking constants when comparing closely related complexities.
- Misapplying big o to non-algorithmic parts like I/O or networking.
| Complexity | Description | Typical Scenarios | Example Algorithm |
|---|---|---|---|
| O(1) | |||
| O(log n) | |||
| O(n) | |||
| O(n log n) | |||
| O(n^2) |