The Ackermann Function
The Ackermann function Ak(j) is defined recursively:
A0(j)=j+1
Ak(j)=Ak−1(j+1)(j)for k≥1
where f(m)(x) denotes the m-fold iterated application of f. That is:
f(0)(x)=x,f(m+1)(x)=f(f(m)(x))
Concrete Values
| k | Ak(1) | Growth |
|---|
| 0 | A0(1)=2 | Linear |
| 1 | A1(1)=A0(2)(1)=A0(A0(1))=A0(2)=3 | Small |
| 2 | A2(1)=A1(2)(1)=A1(A1(1))=A1(3) | Growing |
| A1(3)=A0(4)(3)=3+4=7, so A2(1)=7 | |
| 3 | A3(1)=A2(2)(1)=A2(A2(1))=A2(7) | Exploding |
| A2(7)=27+3−3=1021, so A3(1)=2047 | |
| 4 | A4(1)≈22265536 | Astronomically large |
The function grows incomprehensibly fast. A4(1) is already far larger than the number of atoms in the observable universe.
The Inverse Ackermann Function
The inverse Ackermann function α(n) is defined as:
α(n)=min{k∣Ak(1)≥n}
In words: the smallest k such that the Ackermann function with parameter k and argument 1 reaches or exceeds n.
Values of α(n)
| n | α(n) |
|---|
| 0,1,2 | 0 |
| 3 | 1 |
| 4…7 | 2 |
| 8…2047 | 3 |
| 2048…A4(1)−1 | 4 |
For any n that could ever arise in practice (even n=1080, the estimated number of atoms in the universe), α(n)≤4. The function grows so slowly that it is effectively constant.
The Union-Find Complexity Result
Theorem (Tarjan, 1975): A sequence of m MakeSet, Union, and Find operations, of which n are MakeSet, on a disjoint-set forest with union by rank and path compression takes O(m⋅α(n)) time in the worst case.
Since α(n)≤4 for all practical n, this is effectively O(m) — linear time.
Proof Sketch (Beyond Exam Scope)
The full proof partitions ranks into blocks based on how many times log∗ must be applied to bring the rank below a threshold. Each node is assigned a “level” in this hierarchy. Path compression is charged to nodes moving between levels, and the potential function captures that each node can only move a bounded number of levels (at most α(n) times). The full argument appears in CLRS Chapter 21.
What You Need to Know for the Exam
- The result: m operations on n elements take O(m⋅α(n)) time with union by rank and path compression.
- The definition: α(n)=min{k:Ak(1)≥n}.
- The practical bound: α(n)≤4 for any n less than A4(1), which covers all realistic input sizes.
- The two heuristic names: Union by rank and path compression.
- How Kruskal uses it: Sorting dominates; the union-find operations contribute O(E⋅α(V)), so overall O(ElogV).
You are NOT expected to reproduce the full Tarjan proof. You should be able to state the result, define α(n), compute small values, and explain why the bound is effectively constant.
Worked Example: α(n) Computation
Compute α(100):
- A0(1)=2, not ≥100
- A1(1)=3, not ≥100
- A2(1)=7, not ≥100
- A3(1)=2047≥100
Smallest k is 3, so α(100)=3.
Compute α(106):
- A3(1)=2047, not ≥106
- A4(1) is enormous, ≥106
So α(106)=4.
Summary
| Concept | Detail |
|---|
| Ackermann function | A0(j)=j+1, Ak(j)=Ak−1(j+1)(j) |
| Inverse Ackermann | α(n)=min{k:Ak(1)≥n} |
| α(n) values | n≤2⇒0, n=3⇒1, n=4..7⇒2, n=8..2047⇒3, n≥2048⇒4 |
| Union-find bound | O(m⋅α(n)) with both heuristics |
| Practical constant | α(n)≤4 for all realistic n |
| Exam scope | Result + definition + small values; not full proof |
| Past questions | Ex. sheet 6 q.13; Tripos questions on Kruskal analysis |