CS 411 Fall 2025  >  Outline & Supplemental Notes for November 5, 2025


CS 411 Fall 2025
Outline & Supplemental Notes
for November 5, 2025

Outline

Spanning Trees II: Kruskal’s Algorithm & Union-Find (cont’d) [L 9.2]

Shortest Path: Dijkstra’s Algorithm [L 9.3]

Supplemental Notes

The Ackermann Function

The Ackermann function [W. Ackermann 1928] is one of several mathematical functions that exhibit extremely fast increase.

Here is a standard formulation. Function \(A\) has two nonnegative integer parameters. Its value is a nonnegative integer.

\[ A(m,n) = \begin{cases} n+1, & \text{if \(m = 0\);}\\ A(m-1, 1), & \text{if \(m \gt 0\) and \(n = 0\);}\\ A(m-1, A(m, n-1), & \text{if \(m,n \gt 0\).} \end{cases} \]

Function \(A\) is a standard example of a function that cannot be computed if the only repetition structure allowed is a loop in which the number of iterations is known beforehand. That is, function \(A\) is not primitive recursive.

We can think about \(A(m,n)\) as follows. Essentially, parameter \(m\) determines the operation to apply (addition, multiplication, exponentiation, etc.), while \(n\) is the number of apply it to. Here are some values.

\(m\) \(A(m, n)\)
\(0\) \(n+1\)
\(1\) \(n+2=2+(n+3)-3\)
\(2\) \(2n+3=2(n+3)-3\)
\(3\) \(2^{n+3}-3\)
\(4\) \(\underbrace{2^{2^{\cdot^{\cdot^{\cdot^{2}}}}}}_{n+3}-3\)

We can define a single-parameter version of the above function as follows:

\[ f(n) = A(n,n). \]

Here are some values of this single-parameter Ackermann function.

\(n\) \(f(n)\)
\(0\) \(1\)
\(1\) \(3\)
\(2\) \(7\)
\(3\) \(61\)
\(4\) \(2^{2^{2^{2^{2^{2^{2}}}}}}-3 = 2^{2^{2^{65536}}}-3\)
\(5\) A value that is difficult to imagine

Function \(f\) grows extremely quickly. Its inverse, often denoted by \(\alpha\), grows extremely slowly. Formally, we could define \(\alpha(k)\) to be the least integer \(n\) such that \(f(n) \ge k\). This is the inverse Ackermann function.

The value of \(\alpha(k)\) can be arbitrarily large. However, for all numbers \(k\) that matter in computing—or ever will matter in computing, we have \(\alpha(k) \le 4\).