How efficient is my code?
Algorithmic complexity is one of the fundamental measures of efficiency.
This series of short articles walks through algorithmic complexity from the simplest to the most complex: for each one — what it means and a code example, so you can understand it in practice.
Let's start with the simplest, yet very important one — O(1), or constant complexity.
Parts of the series
- O(1) — constant complexity
- O(n) — linear complexity
- O(log n) — logarithmic complexity
- O(n log n) — linearithmic complexity
- O(n²) — quadratic complexity
- O(n³) — cubic complexity
- O(2ⁿ) — exponential complexity
- O(n!) — factorial complexity
First published in Ukrainian in the Telegram channel “Created to die” on June 20, 2025.