Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Ackermann function related to the amortized complexity of union-find algorithm used for disjoint sets?

Can anybody give me an intuitive explanation of why the Ackermann function http://en.wikipedia.org/wiki/Ackermann_function is related to the amortized complexity of union-find algorithm used for disjoint sets http://en.wikipedia.org/wiki/Disjoint-set_data_structure?

The analysis in Tarjan's data structure book isn't very intuitive.

I also looked it up in Introduction to Algorithms, but it also seems too rigorous and non-intuitive.

Thanks for your help!

like image 556
Tianyang Li Avatar asked Jun 14 '11 11:06

Tianyang Li


People also ask

What is the complexity of union-find algorithm?

You can do n union find (union by rank or size) operations with complexity O(n lg* n) where lg* n is the inverse Ackermann function using path compression optimization.

What is the time complexity of disjoint-set?

Time complexity. A disjoint-set forest implementation in which Find does not update parent pointers, and in which Union does not attempt to control tree heights, can have trees with height O(n). In such a situation, the Find and Union operations require O(n) time.

What is union-find algorithm used for?

A union-find algorithm is an algorithm that performs two useful operations on such a data structure: Find: Determine which subset a particular element is in. This can be used for determining if two elements are in the same subset. Union: Join two subsets into a single subset.

Which operation can be performed on disjoint sets?

Disjoint sets structure is also called "union-find structure". So union , find and MakeSet operations should be supported anyway.

Is union-find faster than DFS?

If the graph is already in memory in adjacency list format, then DFS is slightly simpler and faster (O(n) versus O(n alpha(n)), where alpha(n) is inverse Ackermann), but union-find can handle the edges arriving online in any order, which is sometimes useful (e.g., there are too many to fit in main memory).


1 Answers

Applied to Disjoint-set forests

from Wikipedia

(about find and union) These two techniques complement each other; applied together, the amortized time per operation is only O(α(n)), where α(n) is the inverse of the function f(n) = A(n,n), and A is the extremely quickly-growing Ackermann function. Since α(n) is the inverse of this function, α(n) is less than 5 for all remotely practical values of n. Thus, the amortized running time per operation is effectively a small constant.

So why Ackerman?

from Kruskal algoritm

The Function lg*n

Note that lg*n is a very slow growing function, much slower than lg n. In fact is slower than lg lg n, or any finite composition of lg n. It is the inverse of the function f(n) = 2 ^2^2^…^2, n times. For n >= 5, f(n) is greater than the number of atoms in the universe. Hence for all intents and purposes, the inverse of f(n) for any real life value of n, is constant. From an engineer’s point of view, Kruskal’s algorithm runs in O(e). Note of course that from a theoretician’s point of view, a true result of O(e) would still be a significant breakthrough. The whole picture is not complete because the actual best result shows that lg*n can be replaced by the inverse of A(p,n) where A is Ackermann’s function, a function that grows explosively. The inverse of Ackermann’s function is related to lg*n, and is a nicer result, but the proof is even harder.

like image 80
SDReyes Avatar answered Nov 01 '22 12:11

SDReyes