Download presentation
Presentation is loading. Please wait.
Published byCurtis Simmons Modified over 9 years ago
1
CS 473Lecture X1 CS473-Algorithms I Lecture X Ackermann’s Function and Its Inverse
2
CS 473Lecture X2 Repeated Exponentiation Function g(i) That is i The parameter i gives the height of the stack of 2’s that make up the exponent 4 Repeated Logarithm Function lg (i) n undefined if i = 0 if i > 0 and lg (i-1) n > 0 if i > 0 andorlg (i-1) n is undefined The logarithm fn applied i time in succession starting with arg. n
3
CS 473Lecture X3 Iterated Logarithm Function lg (*) n lg* n = min { i 0 : lg (i) n 1 } lg* 2 = 1 lg* 4 = lg*(2 2 ) = 2 lg* 16 = lg*(2 4 ) = 3 lg* 65536 = lg*(2 16 ) = 4 lg* (2 65536 ) = 5 Since the number of atoms in the observable universe 10 80 << 2 65536 We rarely encounter a value of n such that lg*n > 5
4
CS 473Lecture X4 Computation of lg * 65536 Therefore Iterated Logarithm Function
5
CS 473Lecture X5 The lg * n fn is essentially the inverse of repeated exponentiation nn- 1 n n-2 n-3 where n Iterated Logarithm Function
6
CS 473Lecture X6... n-i... n-n=0 Therefore n Iterated Logarithm Function
7
CS 473Lecture X7 Ackermann’s Function Defined for integers i, j > 1 by A(1, j) = 2 j for j 1 A(i, 1) = A(i – 1, 2)for i 2 A(i, j) = A(i – 1, A(i, j - 1))for i, j 2 j = 1j = 4j = 3j = 2 i = 3 i = 2 i = 1 2121 2 2424 2323
8
CS 473Lecture X8 Ackermann’s Function Defined for integers i, j > 1 by A(1, j) = 2 j for j 1 A(i, 1) = A(i – 1, 2)for i 2 A(i, j) = A(i – 1, A(i, j - 1))for i, j 2 j = 1j = 4j = 3j = 2 i = 3 i = 2 i = 1 2121 2 2424 2323 2
9
CS 473Lecture X9 Ackermann’s Function Defined for integers i, j > 1 by A(1, j) = 2 j for j 1 A(i, 1) = A(i – 1, 2)for i 2 A(i, j) = A(i – 1, A(i, j - 1))for i, j 2 j = 1j = 4j = 3j = 2 i = 3 i = 2 i = 1 2121 2 2424 2323 2 2 2
10
CS 473Lecture X10 Ackermann’s Function Defined for integers i, j > 1 by A(1, j) = 2 j for j 1 A(i, 1) = A(i – 1, 2)for i 2 A(i, j) = A(i – 1, A(i, j - 1))for i, j 2 j = 1j = 4j = 3j = 2 i = 3 i = 2 i = 1 2121 2 2424 2323 2 2 2 2 2
11
CS 473Lecture X11 Ackermann’s Function Defined for integers i, j > 1 by A(1, j) = 2 j for j 1 A(i, 1) = A(i – 1, 2)for i 2 A(i, j) = A(i – 1, A(i, j - 1))for i, j 2 j = 1j = 4j = 3j = 2 i = 3 i = 2 i = 1 2121 2 2424 2323 2 2 2 2 2 16 3 2 4
12
CS 473Lecture X12 Ackermann’s Function Second Row... 2 3 4 j 1
13
CS 473Lecture X13 Ackermann’s Function Third Row 16 ∙ ∙ ∙ ∙
14
CS 473Lecture X14 Ackermann’s Function Third Row ∙ ∙ ∙ ∙ 16 j-1 of these for j 2 The first row, exponential in the column number j, is already rapidly growing The second row, consists of the widely spaced subset of columns of the first row The third row consists of even more widely spaced subset of columns, …, of the second row which is even sparser subset of columns of the first row 16
15
CS 473Lecture X15 Explosive Growth of Ackermann’s Function 1 2 3 4 5 Row Column S1S1 S2S2 S3S3 S4S4 Spacings S1S1 S2S2
16
CS 473Lecture X16 The first row, exponential in the column number j, is already rapidly growing The second row, consists of the widely spaced subset of columns of the first row The third row consists of even more widely spaced subset of columns, …, of the second row which is even sparser subset of columns of the first row 16 Explosive Growth of Ackermann’s Function
17
CS 473Lecture X17 Inverse of Ackermann’s Function α(m, n) = min{ i 1 : A( i, ) > lg n } – Proceed in the -th column of the matrix starting from the first row – Until you encounter a value > lg n – Return the row index of that value IN GENERAL The spacing between successive columns of row i-1 appearing in row i increases dramatically with both the column number and the row number i Explosive Growth of Ackermann’s Function
18
CS 473Lecture X18 Inverse of Ackermann’s Function This fn is not the inverse of Ackermann’s fn in true math sense It captures the spirit of the inverse in its growth The mysterious lg n threshold appears in order to be able to prove the O(m α(m,n)) bound on the running time Claim : for all practical purposes – since – Ackermann’s fn A(i, j) is strictly increasing with each argument – for allsince
19
CS 473Lecture X19 In particular, But we also have A(4,1) = A(3,2) = Hence, A(4,1) >> 10 80 = Estimated no. of atoms in the universe Thus, for all practical purposes 16 Inverse of Ackermann’s Function O(mlg*n) bound is only slightly weaker than O(m α(m,n)) bound, sofor all practical purposes
20
CS 473Lecture X20 An Important Property of Inverse Ackermann’s Function For a fixed value of n, as m increases the function α(m,n) is monotonically decreasing Proof : is monotonically increasing as m increases Thus, since n and hence lg n is fixed, the smallest row index i needed to bring above lg n is monotonically decreasing A(i 1,c 1 ) = First value in col. c 1 > lg n 1 2 ….. i1i1 i2i2 12345...12345... 1 A(i,c 2 ) > A(i,c 1 ) for all i where A(i 2,c 2 ) = First value in col. c 2 > lg n
21
CS 473Lecture X21 An Important Property of Inverse Ackermann’s Function This property corresponds to our intuition about disjoint set forests with path compression We would expect the average FIND-PATH length to decrease due to path compression If we perform m operations in time O(m α(m,n)) then, the average time per operation is O(α(m,n)) which is monotonically decreasing as m increases
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.