![Page 1: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/1.jpg)
© Raimund Seidel
Path Compression and Making the
Inverse Ackermann FunctionAppear Natural(ly)
Raimund Seidel
Universität des Saarlandes
![Page 2: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/2.jpg)
© Raimund Seidel
Theorem:
Any sequence of m Union, Find operationsin a universe of n elements that uses linking by rank and path compressiontakes time at most
O( m·αααα(m,n) +n )
Bob Tarjan 1975
![Page 3: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/3.jpg)
© Raimund Seidel
Theorem:
Any sequence of m Union, Find operationsin a universe of n elements that uses linking by rank and path compressiontakes time at most
O( m·αααα(m,n) +n )
Bob Tarjan 1975
where αααα(m,n) is the “Functional Inverse” of the Ackermann Function.
![Page 4: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/4.jpg)
© Raimund Seidel
What is this αααα(m,n) ??
![Page 5: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/5.jpg)
© Raimund Seidel
What is this αααα(m,n) ??
Why does this αααα(m,n)appear in the analysis ofpath compression ??
![Page 6: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/6.jpg)
© Raimund Seidel
What is this αααα(m,n) ??
![Page 7: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/7.jpg)
© Raimund Seidel
![Page 8: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/8.jpg)
© Raimund Seidel
![Page 9: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/9.jpg)
© Raimund Seidel
This definition of αααα(m,n)is not particularly enlightening.
![Page 10: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/10.jpg)
© Raimund Seidel
Why does this αααα(m,n)appear in the analysis ofpath compression ??
![Page 11: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/11.jpg)
© Raimund Seidel
Union Find with Path Compressions
![Page 12: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/12.jpg)
© Raimund Seidel
Union Find with Path Compressions
Maintain partition of S = { 1,2,L,n}
under operations
1 2
5
9
84
3 6
7
![Page 13: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/13.jpg)
© Raimund Seidel
Union Find with Path Compressions
Maintain partition of S = { 1,2,L,n}
under operations
1 2
5
9
84
3 6
7
Union( 2 , 4 )
1 2
5
9
84
3 6
7
![Page 14: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/14.jpg)
© Raimund Seidel
Union Find with Path Compressions
Maintain partition of S = { 1,2,L,n}
under operations
1 2
5
9
84
3 6
7
Union( 2 , 4 )
1 2
5
9
84
3 6
7
Find( 3 ) = 6 (representative element)
![Page 15: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/15.jpg)
© Raimund Seidel
Implementation
* forest FFFF of rooted trees with node set S* one tree for each group in current partition* root of tree is representative of the group
2 4 6 5 9
1 8 3
7
2 4 6 5 9
1 8 3
7
![Page 16: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/16.jpg)
© Raimund Seidel
Implementation
* forest FFFF of rooted trees with node set S* one tree for each group in current partition* root of tree is representative of the group
2 4 6 5 9
1 8 3
7
2 4 6 5 9
1 8 3
7
Union( 2 , 4 )
4 6 5 9
2 8 3
1 7“Linking”
![Page 17: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/17.jpg)
© Raimund Seidel
Implementation
* forest FFFF of rooted trees with node set S* one tree for each group in current partition* root of tree is representative of the group
2 4 6 5 9
1 8 3
7
2 4 6 5 9
1 8 3
7
Union( 2 , 4 )
4 6 5 9
2 8 3
1 7“Linking”
Find( x ) follow path from x to root “path follwoing”
![Page 18: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/18.jpg)
© Raimund Seidel
Heuristic 1: “linking by rank”
• each node x carries integer rk(x)
• initially rk(x) = 0
• as soon as x is NOT a root, rk(x) stays unchanged
• for Union( x , y ) make node with smaller rankchild of the otherin case of tie, increment one of the
ranksx4 y7
x4 y4
y7x4
y5x4
![Page 19: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/19.jpg)
© Raimund Seidel
Heuristic 2: Path compression
when performin a Find( x ) operation makeall nodes in the “findpath” children of the root
3
2 5 1
7 9 6
11 29
4
23 15
3
2 5 6 11 4 1
7 9 29 23 15
Find( 4 )
![Page 20: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/20.jpg)
© Raimund Seidel
sequence of Union and Find operation
Explicit cost model:
cost( op ) = # times some node gets a new parent
Time for Union(x , y) = O(1) = O(cost( Union(x,y) ))
Time for Find( x ) = O( # of nodes on findpath )
= O( 2 + cost( Find(x) ) )
![Page 21: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/21.jpg)
© Raimund Seidel
For analysis assume all Unions are performed first, but Find-paths are only followed (and compressed) to correct node.
![Page 22: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/22.jpg)
© Raimund Seidel
For analysis assume all Unions are performed first, but Find-paths are only followed (and compressed) to correct node.
![Page 23: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/23.jpg)
© Raimund Seidel
General path compression in forest FFFF
x
a
b
y
compress( x, y )
![Page 24: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/24.jpg)
© Raimund Seidel
General path compression in forest FFFF
x
a
b
y
xab
y
compress( x, y )
![Page 25: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/25.jpg)
© Raimund Seidel
General path compression in forest FFFF
x
a
b
y
xab
y
compress( x, y )
cost( compress( x,y ) ) = # of nodes that get a new parent
![Page 26: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/26.jpg)
© Raimund Seidel
Problem formulation
FFFF forest on node set X
C sequence of compress operations on FFFF
|C| = # of true compress operations in C
cost( C ) = ∑( cost of individual operations )
How large can cost( C ) be at most,in terms of |X| and |C| ?
![Page 27: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/27.jpg)
© Raimund Seidel
Idea:
For the analysis try “divide and conquer.”
![Page 28: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/28.jpg)
© Raimund Seidel
Idea:
For the analysis try “divide and conquer.”
Question:
How do you “divide” ?
![Page 29: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/29.jpg)
© Raimund Seidel
Dissection of a forest FFFF with node set X :
partition of X into “top part” Xtand “bottom part” Xb
so that top part Xt is “upwards closed”,
i.e. x∈Xt ⇒ every ancestor of x is in Xt also
![Page 30: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/30.jpg)
© Raimund Seidel
Dissection of a forest FFFF with node set X :
partition of X into “top part” Xtand “bottom part” Xb
so that top part Xt is “upwards closed”,
i.e. x∈Xt ⇒ every ancestor of x is in Xt also
![Page 31: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/31.jpg)
© Raimund Seidel
Dissection of a forest FFFF with node set X :
partition of X into “top part” Xtand “bottom part” Xb
so that top part Xt is “upwards closed”,
i.e. x∈Xt ⇒ every ancestor of x is in Xt also
Note: Xt, Xb dissection for FFFFF F F F ’ obtained from FFFF bysequence of path compressions
Xt, Xb isdissection for FFFF ’⇒
![Page 32: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/32.jpg)
© Raimund Seidel
Main Lemma:C ... sequence of operations on FFFF with node set XXt, Xb dissection for FFFF inducing subforests FFFFt, FFFFb
![Page 33: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/33.jpg)
© Raimund Seidel
Main Lemma:C ... sequence of operations on FFFF with node set XXt, Xb dissection for FFFF inducing subforests FFFFt, FFFFb
⇒ ∃ compression sequences Cb for FFFFb and Ct for FFFFtwith
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
|Cb| + |Ct| � |C|
and
![Page 34: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/34.jpg)
© Raimund Seidel
Proof: 1) How to get Cb and Ct from C:
![Page 35: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/35.jpg)
© Raimund Seidel
Proof: 1) How to get Cb and Ct from C:
compression paths from C
y
x
y
xinto Ctcase 1:
![Page 36: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/36.jpg)
© Raimund Seidel
Proof: 1) How to get Cb and Ct from C:
compression paths from C
y
x
y
x
y
x
y
x
into Ct
into Cb
case 1:
case 2:
![Page 37: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/37.jpg)
© Raimund Seidel
Proof: 1) How to get Cb and Ct from C:
compression paths from C
y
x
y
x
y
x’
x
y
x
y
x
y
x’
∞∞∞∞
x
into Ct
into Cb
into Ct
into Cb
case 1:
case 2:
case 3:
![Page 38: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/38.jpg)
© Raimund Seidel
compress( x, ∞∞∞∞ )
“rootpath compress”
X
x A
a B
b C
c
C
c
B
b
A
a
X
x
![Page 39: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/39.jpg)
© Raimund Seidel
compress( x, ∞∞∞∞ )
cost( compress( x, ∞∞∞∞ ) ) = # of nodes that get a new parent
= 0
“rootpath compress”
X
x A
a B
b C
c
C
c
B
b
A
a
X
x
![Page 40: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/40.jpg)
© Raimund Seidel
Proof:
compression paths from C
y
x
y
x
y
x’
x
y
x
y
x
y
x’
∞∞∞∞
x
into Ct
into Cb
into Ct
into Cb
case 1:
case 2:
case 3:
|Cb| + |Ct| � |C|
![Page 41: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/41.jpg)
© Raimund Seidel
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
![Page 42: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/42.jpg)
© Raimund Seidel
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
cost( C )
![Page 43: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/43.jpg)
© Raimund Seidel
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
green node gets new green parent: accounted by cost(Ct)
cost( C )
![Page 44: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/44.jpg)
© Raimund Seidel
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
green node gets new green parent: accounted by cost(Ct)
brown node gets new brown parent: accounted by cost(Cb)
cost( C )
![Page 45: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/45.jpg)
© Raimund Seidel
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
green node gets new green parent: accounted by cost(Ct)
brown node gets new brown parent: accounted by cost(Cb)
brown node gets new green parent: accounted by |Xb|for the first time
cost( C )
![Page 46: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/46.jpg)
© Raimund Seidel
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
green node gets new green parent: accounted by cost(Ct)
brown node gets new brown parent: accounted by cost(Cb)
brown node gets new green parent: accounted by |Xb|for the first time - #roots( FFFFb )
cost( C )
![Page 47: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/47.jpg)
© Raimund Seidel
cost(C) � cost(Cb) + cost(Ct) + |Xb| - #roots(FFFFb) + |Ct|
green node gets new green parent: accounted by cost(Ct)
brown node gets new brown parent: accounted by cost(Cb)
brown node gets new green parent: accounted by |Xb|for the first time - #roots( FFFFb )
cost( C )
![Page 48: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/48.jpg)
© Raimund Seidel
cost(C) � cost(Cb) + cost(Ct) + |Xb| - #roots(FFFFb) + |Ct|
green node gets new green parent: accounted by cost(Ct)
brown node gets new brown parent: accounted by cost(Cb)
brown node gets new green parent: accounted by |Xb|for the first time - #roots( FFFFb )
brown node gets new green parent: accounted by |Ct|again
cost( C )
![Page 49: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/49.jpg)
© Raimund Seidel
Main Lemma’:C ... sequence of operations on FFFF with node set XXt, Xb dissection for FFFF inducing subforests FFFFt, FFFFb
⇒ ∃ compression sequences Cb for FFFFb and Ct for FFFFtwith
cost( C ) � cost( Cb ) + cost( Ct )+ |Xb| - #roots(FFFFb) + |Ct|
|Cb| + |Ct| � |C|
and
![Page 50: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/50.jpg)
© Raimund Seidel
f(m,n) ... maximum cost of any compressionsequence C with |C|=m in an arbitraryforest with n nodes.
Claim: f(m,n) � (m+n)·log2n
![Page 51: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/51.jpg)
© Raimund Seidel
Claim: f(m,n) � (m+n)·log2n
![Page 52: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/52.jpg)
© Raimund Seidel
Claim: f(m,n) � (m+n)·log2n
Proof:
Xforest FFFF|X|=n
C compression sequence |C|=m
![Page 53: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/53.jpg)
© Raimund Seidel
Claim: f(m,n) � (m+n)·log2n
Proof:
XXb
Xtforest FFFF|X|=n
FFFFb
FFFFt |Xt|=|Xb|=n/2
C compression sequence |C|=m
![Page 54: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/54.jpg)
© Raimund Seidel
Claim: f(m,n) � (m+n)·log2n
Proof:
XXb
Xtforest FFFF|X|=n
FFFFb
FFFFt |Xt|=|Xb|=n/2
C compression sequence |C|=m
Main Lemma ⇒ ∃ Ct, Cb |Cb|+|Ct| � |C|
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
mb + mt � m
![Page 55: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/55.jpg)
© Raimund Seidel
Claim: f(m,n) � (m+n)·log2n
Proof:
XXb
Xtforest FFFF|X|=n
FFFFb
FFFFt |Xt|=|Xb|=n/2
C compression sequence |C|=m
Main Lemma ⇒ ∃ Ct, Cb |Cb|+|Ct| � |C|
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
mb + mt � m
Induction: � (mb+n/2)log n/2 + (mt+n/2)log n/2 + n/2 + mt
![Page 56: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/56.jpg)
© Raimund Seidel
Claim: f(m,n) � (m+n)·log2n
Proof:
XXb
Xtforest FFFF|X|=n
FFFFb
FFFFt |Xt|=|Xb|=n/2
C compression sequence |C|=m
Main Lemma ⇒ ∃ Ct, Cb |Cb|+|Ct| � |C|
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
mb + mt � m
Induction: � (mb+n/2)log n/2 + (mt+n/2)log n/2 + n/2 + mt
� (mb+mt+n/2+n/2)log n/2 + n + m
![Page 57: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/57.jpg)
© Raimund Seidel
Claim: f(m,n) � (m+n)·log2n
Proof:
XXb
Xtforest FFFF|X|=n
FFFFb
FFFFt |Xt|=|Xb|=n/2
C compression sequence |C|=m
Main Lemma ⇒ ∃ Ct, Cb |Cb|+|Ct| � |C|
cost( C ) � cost( Cb ) + cost( Ct ) + |Xb| + |Ct|
mb + mt � m
Induction: � (mb+n/2)log n/2 + (mt+n/2)log n/2 + n/2 + mt
� (mb+mt+n/2+n/2)log n/2 + n + m
� (m+n)·log2n/2 + (m+n) = (m+n)·log2n
![Page 58: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/58.jpg)
© Raimund Seidel
Corollary:Any sequence of m Union, Find operationsin a universe of n elements that usesarbitrary linking and path compressiontakes time at most
O( (m+n)·log n)
![Page 59: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/59.jpg)
© Raimund Seidel
Corollary:Any sequence of m Union, Find operationsin a universe of n elements that usesarbitrary linking and path compressiontakes time at most
O( (m+n)·log n)
By choosing a dissection that is “unbalanced”in relation to m/n one can prove a betterbound of
O( (m+n)·log⌈m/n⌉+1 n)
![Page 60: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/60.jpg)
© Raimund Seidel
Corollary:Any sequence of m Union, Find operationsin a universe of n elements that usesarbitrary linking and path compressiontakes time at most
O( (m+n)·log n)
By choosing a dissection that is “unbalanced”in relation to m/n one can prove a betterbound of
O( (m+n)·log⌈m/n⌉+1 n)
Proof: exercise
![Page 61: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/61.jpg)
© Raimund Seidel
Path compression and union by rank
![Page 62: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/62.jpg)
© Raimund Seidel
f : N → R Brief digression
![Page 63: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/63.jpg)
© Raimund Seidel
0 if n � 1
1 + f*( f(n) ) if n > 1f*(n) =
f : N → R Brief digression
![Page 64: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/64.jpg)
© Raimund Seidel
0 if n � 1
1 + f*( f(n) ) if n > 1f*(n) =
f*(n) = min { k | f(f( LL f(n)L) � 1 }
k times
f : N → R Brief digression
![Page 65: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/65.jpg)
© Raimund Seidel
0 if n � 1
1 + f*( f(n) ) if n > 1f*(n) =
f*(n) = min { k | f(f( LL f(n)L) � 1 }
k times
Properties: f a “nice” compaction, i.e. f(n)<n-1⇒ f* a “nice” compaction andf* “much smaller” than f
f : N → R Brief digression
![Page 66: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/66.jpg)
© Raimund Seidel
Examples for f* :
f(n) f*(n)
n-1 n-1
n-2 n/2
n-c n/c
n/2 log2n
n/c logcn
n log log n
log n log*n
Brief digression
![Page 67: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/67.jpg)
© Raimund Seidel
Path compression and union by rank
Def: FFFF forest, x node in FFFFr(x) = height of subtree rooted at x
( r(leaf) = 0 )
FFFF is a rank forest, if
for every node xfor every i with 0�i<r(x),
there is a child yi of x with r(yi)=i .
![Page 68: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/68.jpg)
© Raimund Seidel
Path compression and union by rank
Def: FFFF forest, x node in FFFFr(x) = height of subtree rooted at x
( r(leaf) = 0 )
FFFF is a rank forest, if
for every node xfor every i with 0�i<r(x),
there is a child yi of x with r(yi)=i .
Note: Union by rank produces rank forests !
![Page 69: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/69.jpg)
© Raimund Seidel
Path compression and union by rank
Def: FFFF forest, x node in FFFFr(x) = height of subtree rooted at x
( r(leaf) = 0 )
FFFF is a rank forest, if
for every node xfor every i with 0�i<r(x),
there is a child yi of x with r(yi)=i .
Note: Union by rank produces rank forests !
Lemma: r(x)=r ⇒ x has at least r children.
![Page 70: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/70.jpg)
© Raimund Seidel
Path compression and union by rank
Def: FFFF forest, x node in FFFFr(x) = height of subtree rooted at x
( r(leaf) = 0 )
FFFF is a rank forest, if
for every node xfor every i with 0�i<r(x),
there is a child yi of x with r(yi)=i .
Note: Union by rank produces rank forests !
Lemma: r(x)=r ⇒ x has at least r childrenand at least 2r descendants.
![Page 71: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/71.jpg)
© Raimund Seidel
Inheritance Lemma:
FFFF rank forest with maximum rank r and node set X
s∈N: X>s = { x∈X | r(x)>s } FFFF>s
X�s = { x∈X | r(x)�s } FFFF�sinduced forests
![Page 72: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/72.jpg)
© Raimund Seidel
Inheritance Lemma:
FFFF rank forest with maximum rank r and node set X
s∈N: X>s = { x∈X | r(x)>s } FFFF>s
X�s = { x∈X | r(x)�s } FFFF�sinduced forests
i) X�s , X>s is a dissection for FFFF
ii) FFFF�s is a rank forest with maximumrank � s
iii) FFFF>s is a rank forest with maximumrank � r-s-1
![Page 73: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/73.jpg)
© Raimund Seidel
Inheritance Lemma:
FFFF rank forest with maximum rank r and node set X
s∈N: X>s = { x∈X | r(x)>s } FFFF>s
X�s = { x∈X | r(x)�s } FFFF�sinduced forests
FFFFt
FFFFb
i) X�s , X>s is a dissection for FFFF
ii) FFFF�s is a rank forest with maximumrank � s
iii) FFFF>s is a rank forest with maximumrank � r-s-1
s
r-s-1
![Page 74: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/74.jpg)
© Raimund Seidel
Inheritance Lemma:
FFFF rank forest with maximum rank r and node set X
s∈N: X>s = { x∈X | r(x)>s } FFFF>s
X�s = { x∈X | r(x)�s } FFFF�sinduced forests
FFFFt
FFFFb
i) X�s , X>s is a dissection for FFFF
ii) FFFF�s is a rank forest with maximumrank � s
iii) FFFF>s is a rank forest with maximumrank � r-s-1
s
r-s-1
Proofs: exercise
![Page 75: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/75.jpg)
© Raimund Seidel
f(m,n,r) = maximum cost of any compressionsequence C, with |C|=m, in rankforest FFFF with n nodes andmaximum rank r.
![Page 76: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/76.jpg)
© Raimund Seidel
f(m,n,r) = maximum cost of any compressionsequence C, with |C|=m, in rankforest FFFF with n nodes andmaximum rank r.
Trivial bounds:
f(m,n,r) � (r-1)·n
f(m,n,r) � (r-1)·m
![Page 77: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/77.jpg)
© Raimund Seidel
f(m,n,r) = maximum cost of any compressionsequence C, with |C|=m, in rankforest FFFF with n nodes andmaximum rank r.
Trivial bounds:
f(m,n,r) � (r-1)·n
f(m,n,r) � (r-1)·m
f(m,n,r) � m + (r-2)·n
![Page 78: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/78.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
![Page 79: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/79.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
� f(mt,nt,r-s-1) +
![Page 80: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/80.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
� f(mt,nt,r-s-1) + f(mb,nb,s) +
![Page 81: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/81.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
� f(mt,nt,r-s-1) + f(mb,nb,s) + n-nt –
![Page 82: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/82.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
� f(mt,nt,r-s-1) + f(mb,nb,s) + n-nt – (s+1)·nt +
![Page 83: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/83.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
� f(mt,nt,r-s-1) + f(mb,nb,s) + n-nt – (s+1)·nt +
Each node in FFFFt has at least s+1 children in FFFFb , and they must all be different roots of FFFFb .
![Page 84: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/84.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
� f(mt,nt,r-s-1) + f(mb,nb,s) + n-nt – (s+1)·nt + mt
Each node in FFFFt has at least s+1 children in FFFFb , and they must all be different roots of FFFFb .
![Page 85: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/85.jpg)
© Raimund Seidel
FFFFt
FFFFb
rs |X� s| = nb = n-nt |Cb| = mb
r-s-1 < r |X>s| = nt |Ct| = mt
cost( C ) � cost( Ct ) + cost( Cb ) + |Xb| - #rts(FFFFb) + |Ct|
� f(mt,nt,r-s-1) + f(mb,nb,s) + n-nt – (s+1)·nt + mt
Each node in FFFFt has at least s+1 children in FFFFb , and they must all be different roots of FFFFb .
f(m,n,r) � f(mt,nt,r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
![Page 86: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/86.jpg)
© Raimund Seidel
f(m,n,r) � f(mt,nt,r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
nt + nb = n mt + mb � m
0� s < r
![Page 87: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/87.jpg)
© Raimund Seidel
f(m,n,r) � f(mt,nt,r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
nt + nb = n mt + mb � m
0� s < r
Assume: f(M,N,R) � k·M + N·g(R)
![Page 88: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/88.jpg)
© Raimund Seidel
f(m,n,r) � f(mt,nt,r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
nt + nb = n mt + mb � m
0� s < r
f(m,n,r) � k·mt + nt·g(r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
� k·mt + nt·g(r) + f(mb,nb,s) + n – s·nt + mt
Assume: f(M,N,R) � k·M + N·g(R)
![Page 89: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/89.jpg)
© Raimund Seidel
f(m,n,r) � f(mt,nt,r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
nt + nb = n mt + mb � m
0� s < r
f(m,n,r) � k·mt + nt·g(r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
� k·mt + nt·g(r) + f(mb,nb,s) + n – s·nt + mt
choose s = g(r)
Assume: f(M,N,R) � k·M + N·g(R)
![Page 90: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/90.jpg)
© Raimund Seidel
f(m,n,r) � f(mt,nt,r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
nt + nb = n mt + mb � m
0� s < r
f(m,n,r) � k·mt + nt·g(r-s-1) + f(mb,nb,s) + n – (s+2)·nt + mt
� k·mt + nt·g(r) + f(mb,nb,s) + n – s·nt + mt
choose s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,nb,s) + n
� (k+1)·mt + f(mb,n,s) + n
Assume: f(M,N,R) � k·M + N·g(R)
![Page 91: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/91.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n
![Page 92: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/92.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
![Page 93: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/93.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
m
![Page 94: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/94.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
f(m,n,r) – (k+1)·m � f(mb,n,s) – (k+1)·mb + n
m
![Page 95: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/95.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
f(m,n,r) – (k+1)·m � f(mb,n,s) – (k+1)·mb + n
φ(m,n,r) � φ(mb,n,g(r)) + n
m
![Page 96: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/96.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
f(m,n,r) – (k+1)·m � f(mb,n,s) – (k+1)·mb + n
φ(m,n,r) � φ(mb,n,g(r)) + n
m
� (φ(mbb,n,g(g(r))) + n) + n
![Page 97: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/97.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
f(m,n,r) – (k+1)·m � f(mb,n,s) – (k+1)·mb + n
φ(m,n,r) � φ(mb,n,g(r)) + n
m
� (φ(mbb,n,g(g(r))) + n) + n
� ((φ(mbbb,n,g(g(g(r)))) + n) + n) + n
![Page 98: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/98.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
f(m,n,r) – (k+1)·m � f(mb,n,s) – (k+1)·mb + n
φ(m,n,r) � φ(mb,n,g(r)) + n
m
� (φ(mbb,n,g(g(r))) + n) + n
� ((φ(mbbb,n,g(g(g(r)))) + n) + n) + n
φ(m,n,r) � n · g*(r)
![Page 99: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/99.jpg)
© Raimund Seidel
s = g(r)
f(m,n,r) � (k+1)·mt + f(mb,n,s) + n -(k+1)·(mb+mt)
f(m,n,r) – (k+1)·m � f(mb,n,s) – (k+1)·mb + n
φ(m,n,r) � φ(mb,n,g(r)) + n
m
� (φ(mbb,n,g(g(r))) + n) + n
� ((φ(mbbb,n,g(g(g(r)))) + n) + n) + n
φ(m,n,r) � n · g*(r)
f(m,n,r) � (k+1)· m + n · g*(r)
![Page 100: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/100.jpg)
© Raimund Seidel
Shifting Lemma:
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+1)·m + n·g*(r)
![Page 101: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/101.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Shifting Lemma:
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+1)·m + n·g*(r)
Shifting Corollary:
i
![Page 102: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/102.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
i
![Page 103: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/103.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � n·(r-1)
i
![Page 104: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/104.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � n·(r-1)
= 0·m + n·(r-1)
i
![Page 105: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/105.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � n·(r-1)
= 0·m + n·(r-1)
g(r) = r-1
g*(r) = r-1
i
![Page 106: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/106.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � m + n·(r-2)
i
![Page 107: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/107.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � m + n·(r-2)
= 1·m + n·(r-2)
i
![Page 108: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/108.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � m + n·(r-2)
= 1·m + n·(r-2)
g(r) = r-2
i
![Page 109: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/109.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � m + n·(r-2)
= 1·m + n·(r-2)
g(r) = r-2
g*(r)= r/2
i
![Page 110: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/110.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � m + n·(r-2)
= 1·m + n·(r-2)
g(r) = r-2
g*(r)= r/2 f(m,n,r) � 2·m + n·(r/2)
i
![Page 111: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/111.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � m + n·(r-2)
= 1·m + n·(r-2)
g(r) = r-2
g*(r)= r/2 f(m,n,r) � 2·m + n·(r/2)
g**(r) = log r
i
![Page 112: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/112.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Trivial bound: f(m,n,r) � m + n·(r-2)
= 1·m + n·(r-2)
g(r) = r-2
g*(r)= r/2 f(m,n,r) � 2·m + n·(r/2)
g**(r) = log r f(m,n,r) � 3·m + n·log r
i
![Page 113: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/113.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
i
![Page 114: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/114.jpg)
© Raimund Seidel
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
We know bound: f(m,n,r) � 3·m + n·log r
i
![Page 115: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/115.jpg)
© Raimund Seidel
Therefore for any i≥ 0 :
f(m,n,r) � (3+i)·m + n·log**...*(r)
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
We know bound: f(m,n,r) � 3·m + n·log r
i
i
![Page 116: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/116.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
![Page 117: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/117.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :
i
![Page 118: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/118.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :i
Define αααα(r) = min{ i | log**...*(r) � i }
i
![Page 119: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/119.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
Choice of i :
Define αααα(r) = min{ i | log**...*(r) � i }
i
Here is your definition of the Inverse Ackermann Function !!
![Page 120: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/120.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
Choice of i :
Define αααα(r) = min{ i | log**...*(r) � i }
f(m,n,r) � (m+n)(3+αααα(r))
i
![Page 121: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/121.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
Choice of i :
Define αααα(r) = min{ i | log**...*(r) � i }
f(m,n,r) � (m+n)(3+αααα(r))
� (m+n)(3+αααα(log n))
i
![Page 122: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/122.jpg)
© Raimund Seidel
Choice of i :
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
![Page 123: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/123.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :i
For t≥ 1 define ααααt(r) = min{ i | log**...*(r) � t }
i
![Page 124: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/124.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :i
For t≥ 1 define ααααt(r) = min{ i | log**...*(r) � t }
i
Here is a parametrized definition of the Inverse Ackermann Function !!
![Page 125: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/125.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :i
For t≥ 1 define ααααt(r) = min{ i | log**...*(r) � t }
i
f(m,n,r) � (3+ααααt(r))·m + n·t
![Page 126: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/126.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :i
For t≥ 1 define ααααt(r) = min{ i | log**...*(r) � t }
i
f(m,n,r) � (3+ααααt(r))·m + n·t
choose t = 1+m/n
![Page 127: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/127.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :i
For t≥ 1 define ααααt(r) = min{ i | log**...*(r) � t }
i
f(m,n,r) � (3+ααααt(r))·m + n·t
choose t = 1+m/n
f(m,n,r) � (4+αααα1+m/n(r))·m + n
![Page 128: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/128.jpg)
© Raimund Seidel
For any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
Choice of i :i
For t≥ 1 define ααααt(r) = min{ i | log**...*(r) � t }
i
f(m,n,r) � (3+ααααt(r))·m + n·t
choose t = 1+m/n
f(m,n,r) � (4+αααα1+m/n(r))·m + n
� (4+αααα1+m/n(log n))·m + n
![Page 129: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/129.jpg)
© Raimund Seidel
Theorem:
Any sequence of m Union, Find operationsin a universe of n elements that uses linking by rank and path compressiontakes time at most
O( m·αααα(m,n) +n )
Bob Tarjan 1975
![Page 130: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/130.jpg)
© Raimund Seidel
Theorem:
Any sequence of m Union, Find operationsin a universe of n elements that uses linking by rank and path compressiontakes time at most
O( m·αααα(m,n) +n )
Bob Tarjan 1975
f(m,n,r) � (4+αααα1+m/n(log n))·m + n
![Page 131: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/131.jpg)
© Raimund Seidel
Theorem:
Any sequence of m Union, Find operationsin a universe of n elements that uses linking by rank and path compressiontakes time at most
O( m·αααα(m,n) +n )
Bob Tarjan 1975
f(m,n,r) � (4+αααα1+m/n(log n))·m + n
αααα(m,n) = αααα1+m/n(log n)
![Page 132: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/132.jpg)
© Raimund Seidel
Shifting Lemma:
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+1)·m + n·g*(r)
If f(m,n,r) � k·m + n·g(r)
then also f(m,n,r) � (k+i)·m + n·g**...*(r)
for any i ≥ 0
Shifting Corollary:
i
Definition of αααα: i
αααα(r) = min{ i | log**...*(r) � i }
What to remember:
![Page 133: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/133.jpg)
© Raimund Seidel
Odds and Ends
![Page 134: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/134.jpg)
© Raimund Seidel
Odds and Ends
We used f(m,n,r) � 1·m + n·(r-2)
![Page 135: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/135.jpg)
© Raimund Seidel
Odds and Ends
We used f(m,n,r) � 1·m + n·(r-2) to get
for any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
![Page 136: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/136.jpg)
© Raimund Seidel
Odds and Ends
We used f(m,n,r) � 1·m + n·(r-2) to get
Actually f(m,n,r) � 1·m + n·log r
for any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
![Page 137: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/137.jpg)
© Raimund Seidel
Odds and Ends
We used f(m,n,r) � 1·m + n·(r-2) to get
Actually f(m,n,r) � 1·m + n·log r(Exercise)
for any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
![Page 138: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/138.jpg)
© Raimund Seidel
Odds and Ends
We used f(m,n,r) � 1·m + n·(r-2) to get
for any i≥ 0 : f(m,n,r) � (1+i)·m + n·log**...*(r)
i
Actually f(m,n,r) � 1·m + n·log r
and therefore(Exercise)
for any i≥ 0 : f(m,n,r) � (3+i)·m + n·log**...*(r)
i
![Page 139: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/139.jpg)
© Raimund Seidel
Odds and Ends
For any i≥ 0 : f(m,n,r) � i·m + n·log**...*(r)
i
Actually f(m,n,r) � 1·m + n·log* r
and therefore
(difficultExercise)
![Page 140: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/140.jpg)
© Raimund Seidel
Odds and Ends
f(m,n,r) for small values of r
![Page 141: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/141.jpg)
© Raimund Seidel
Odds and Ends
f(m,n,0) = 0 f(m,n,1) = 0 f(m,n,2) � m
f(m,n,r) for small values of r
![Page 142: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/142.jpg)
© Raimund Seidel
Odds and Ends
f(m,n,0) = 0 f(m,n,1) = 0 f(m,n,2) � m
f(m,n,r) � m + n for r� 8, i.e. for n<512
f(m,n,r) for small values of r
![Page 143: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/143.jpg)
© Raimund Seidel
Odds and Ends
f(m,n,0) = 0 f(m,n,1) = 0 f(m,n,2) � m
f(m,n,r) � m + n for r� 8, i.e. for n<512
f(m,n,r) � m + 2n for r� 202, i.e. for n<2203
f(m,n,r) for small values of r
![Page 144: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/144.jpg)
© Raimund Seidel
Odds and Ends
f(m,n,0) = 0 f(m,n,1) = 0 f(m,n,2) � m
f(m,n,r) � m + n for r� 8, i.e. for n<512
f(m,n,r) � m + 2n for r� 202, i.e. for n<2203
f(m,n,r) for small values of r
(difficult exercises)
![Page 145: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/145.jpg)
© Raimund Seidel
Similar proof for O( m·αααα(m,n) + n ) bound also works for
* linking by weight and path compression
* linking by rank and generalized pathcompaction
Odds and Ends
![Page 146: Path Compression and Making the InverseAckermann Function …€¦ · © Raimund Seidel Theorem: Any sequence of mUnion, Find operations in a universe of n elements that uses linking](https://reader035.vdocuments.mx/reader035/viewer/2022081617/6045e182e6e51e0771396c84/html5/thumbnails/146.jpg)
© Raimund Seidel
Similar proof for O( m·αααα(m,n) + n ) bound also works for
* linking by weight and path compression
* linking by rank and generalized pathcompaction
Odds and Ends
Open problem:
simple top-down approach for provinglower bounds