0% found this document useful (0 votes)
42 views8 pages

Algo2 Greedy Union Find6 Typed

The document discusses the Ackermann function and its inverse, the inverse Ackermann function. It defines the Ackermann function recursively and shows that A1(r) corresponds to doubling r, while A2(r) corresponds to raising r to the power of r. It then defines the inverse Ackermann function α(n) as the minimum k such that Ak(2) is greater than or equal to n. Tarjan's theorem states that m UNION+FIND operations take O(mα(n)) time.

Uploaded by

sirj0_hn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views8 pages

Algo2 Greedy Union Find6 Typed

The document discusses the Ackermann function and its inverse, the inverse Ackermann function. It defines the Ackermann function recursively and shows that A1(r) corresponds to doubling r, while A2(r) corresponds to raising r to the power of r. It then defines the inverse Ackermann function α(n) as the minimum k such that Ak(2) is greater than or equal to n. Tarjan's theorem states that m UNION+FIND operations take O(mα(n)) time.

Uploaded by

sirj0_hn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Advanced

Union-Find

The Ackermann Function


Algorithms: Design
and Analysis, Part II
Tarjan’s Bound
Theorem: [Tarjan 75] With Union by Rank and path compression,
m UNION+FIND operations take O(mα(n)) time, where α(n) is
the inverse Ackerman function (will define in this video)

Proof in next video.

Tim Roughgarden
The Ackermann Function
Aside: Many different definitions, all more or less equivalent.
Will define Ak (r ) for all integers k and r ≥ 1. (recursively)
Base case: A0 (r ) = r + 1 for all r ≥ 1.
In general: For k, r ≥ 1:
Ak (r ) = Apply Ak−1 r times to r
= (Ak−1 ◦ Ak−1 ◦ . . . ◦ Ak−1 )(r )

r -fold composition

Tim Roughgarden
Quiz: A1
Quiz: A1 (r ) corresponds to what function of r ?
A) Successor (r 7→ r + 1)
B) Doubling (r 7→ 2r )
C) Exponentation (r 7→ 2r )
... r times ...2
D) Tower function (r 7→ 22 )

A1 (r ) = (A0 ◦ A0 ◦ . . . ◦ A0 )(r ) = 2r
(r -fold composition, add 1 each time)

Tim Roughgarden
Quiz: A2
Quiz: What function does A2 (r ) correspond to?
A) r 7→ 4r
B) r 7→ 2r
B) r 7→ r 2r
... r times ...2
D) r 7→ 22

A2 (r ) = (A1 ◦ A1 ◦ . . . ◦ A1 )(r ) = r 2r
(r -fold composition, doubles each time)

Tim Roughgarden
Quiz: A3
Quiz: What is A3 (2)? Recall A2 (r ) = r 2r
A) 8
B) 1024
B) 2048
D) Bigger than 2048

A3 (2) = A2 (A2 (2)) = A2 (8) = 828 = 211 = 2048

In general: A3 (r ) = (A2 ◦ A2 ◦ . . . (r times) . . . ◦ A2 )(r ) ≥ a tower


... r times ...2
of r 2’s = 22

Tim Roughgarden
A4
... height 2048 ...2
A4 (2) = A3 (A3 (2)) = A3 (2048) ≥ 22

In general: A4 (r ) = (A3 ◦ . . . r times . . . ◦ A3 )(r ) ≈ iterated tower


function (aka “wowzer” function)

Tim Roughgarden
The Inverse Ackermann Function
Definition: For every n ≥ 4, α(n) = minimum value of k such that
Ak (2) ≥ n.

α(n) = 1, n = 4 (A1 (2) = 4) log∗ n = 1, n = 2


α(n) = 2, n = 5, . . . , 8 (A2 (2) = 8) log∗ n = 2, n = 3, 4
α(n) = 3, n = 9, 10, . . . , 2048 log∗ n = 3, n = 5, . . . , 16
α(n) = 4, n up to roughly a tower log∗ n = 4, n = 17, 65536
of 2’s of height 2048 log∗ n = 5, n = 65537, 265536
α(n) = 5 for n up to ??? log∗ n = 2048 for such n

Tim Roughgarden

You might also like