an algorithm can be categorized by 2 variants of resource growth complexities:
- time complexity - how fast the algorithm runs in terms of input size
- space/memory complexity - how much space/memory the algorithm needs in terms of input size
Growth Complexity Types (increasing order)
|
Growth (𝑛) |
Name |
|---|---|
|
1 |
constant |
|
𝛼(𝑛) |
inverse Ackermann |
|
𝑙𝑜𝑔*(𝑛) ≈ 𝑠𝑙𝑜𝑔(𝑛) |
iterated/super logarithmic |
|
𝑙𝑜𝑔(𝑙𝑜𝑔(𝑛)) |
log-logarithmic |
|
𝑙𝑜𝑔(𝑛) |
logarithmic |
|
𝑙𝑜𝑔(𝑛)𝑘 where 𝑘 > 1 |
poly-logarithmic |
|
𝑛𝑘 where 0 < 𝑘 < 1 |
fractional power |
|
𝑛 |
linear |
|
𝑛 𝑙𝑜𝑔*(𝑛) |
n log-star n |
|
linearithmic | |
|
𝑛 𝑙𝑜𝑔(𝑛)𝑘where 𝑘 > 1 |
quasi-linear |
|
𝑛𝑘 where 𝑘 > 1 𝑘𝑙𝑜𝑔(𝑛)where 𝑘 > 1 |
polynomial
|
|
𝑘𝑙𝑜𝑔(𝑛)𝑐 where 𝑐 > 1 and 𝑘 > 1 |
quasi-polynomial or pseudo-polynomial |
|
𝑂(2𝑛𝑒) for all 𝑒 > 0 |
sub-exponential (1st definition) |
|
2𝑜(𝑛) |
sub-exponential (2nd definition) |
|
𝑘𝑛 where 𝑘 > 1 |
exponential |
|
𝑛! |
factorial |
|
𝑛𝑛 |
super exponential |
|
𝑐(𝑘𝑝𝑜𝑙𝑦(𝑛)) |
double exponential time |