[ACM] Link-Cut Tree achieve dynamic tree Probe

Dynamic tree problem refers to a class of problems, not refer specifically to a certain data structures. It is one of several major maintenance rooted tree forests contain realize the forest changes and inquiries.

Dynamic tree data structure is said that there are four kinds, Link-Cut Tree is one of them. Link-Cut Tree can be viewed as a forest mapping request, the mapping relationship between them will be described in later.

Let me talk about Link-Cut Tree support basic operations include:

1. (access) Link-Cut Tree's core operations, operations need to access the back of this operation support.

2. (it makes) the establishment of a tree in the forest.

3. (findroot) querying the root of a tree in the forest.

4. (cut) is separated from the current node to a tree, a tree is divided into two trees.

5. (link) to two different root tree merge, the two trees is merged into a tree.

By the above-described basic operations, it is possible to achieve some of the fundamental problems dynamic tree. Note that, Link-Cut Tree operation achieved only to the root node, but we can achieve some point by modifying the basic operation, such as seeking the LCA, the specific process will be covered in detail later.

Come to talk about Link-Cut Tree data organization, said before the data should first elaborate organization Link-Cut Tree of what Link-Cut Tree's core operating access (u), it helps to understand.

Access (u) u is an access node operation (access to the root from u), u is actually looking for the path to the root node. If you simply back up the roots, then the face of very long chain tree, the time complexity would degenerate into linear. Link-Cut Tree splay trees using this data structure, the parent node will extend upwardly added to the tree access

Guess you like

Origin www.cnblogs.com/mcflurry/p/2948460.html