# Big-O Complexity — designpattern.fyi

> Time and space complexity analysis for algorithms and data structures

- **Section**: Big-O Complexity
- **Canonical URL**: https://designpattern.fyi/big_o/

---

## Patterns in this Category


### [O(1) - Constant Time](https://designpattern.fyi/big_o/constant-time/)
- **Summary**: Same speed whether your dataset has 1 item or 1 billion. The holy grail.
- **Subcategory**: complexity


### [O(2ⁿ) - Exponential Time](https://designpattern.fyi/big_o/exponential-time/)
- **Summary**: Doubles with every extra element — n=50 already takes longer than the age of the universe.
- **Subcategory**: complexity


### [O(log n) - Logarithmic Time](https://designpattern.fyi/big_o/logarithmic-time/)
- **Summary**: Cuts the problem in half each step — searching a billion items in ~30 steps.
- **Subcategory**: complexity


### [O(n log n) - Linearithmic Time](https://designpattern.fyi/big_o/linearithmic-time/)
- **Summary**: The sweet spot for sorting — better than O(n²), as good as sorting gets.
- **Subcategory**: complexity


### [O(n!) - Factorial Time](https://designpattern.fyi/big_o/factorial-time/)
- **Summary**: The worst standard complexity. n=20 means 2.4 quintillion operations. Brute-force only.
- **Subcategory**: complexity


### [O(n) - Linear Space](https://designpattern.fyi/big_o/linear-space/)
- **Summary**: Memory grows proportionally with input — trading RAM for speed is often worth it.
- **Subcategory**: complexity


### [O(n) - Linear Time](https://designpattern.fyi/big_o/linear-time/)
- **Summary**: Touch every element exactly once — unavoidable when you need to see all the data.
- **Subcategory**: complexity


### [O(n²) - Quadratic Time](https://designpattern.fyi/big_o/quadratic-time/)
- **Summary**: Two nested loops over the same data — fine for n&lt;1000, catastrophic at scale.
- **Subcategory**: complexity


### [O(n³) - Cubic Time](https://designpattern.fyi/big_o/cubic-time/)
- **Summary**: Three nested loops — fine only for n &lt; 100. Gets painful fast.
- **Subcategory**: complexity



---

## Machine-Readable Resources
- **JSON Feed**: https://www.designpattern.fyi/api/patterns.json
- **OpenAPI 3.1**: https://www.designpattern.fyi/api/openapi.json
- **llms.txt**: https://www.designpattern.fyi/llms.txt
