Application of the center of gravity of the tree

  Some properties of the tree of the center of gravity are not well understood in this summary.

Application dotted rule gravity point of the tree points trees dynamic maintenance of the center of gravity of the tree and so on.

Complexity About a dotted rule is actually applied on the idea of ​​partition or ideological CDQ range of constantly recursive partition, this partition can quickly separate the break in the trees while we are mid not quickly come to the mid of.

Complexity proof partition section each time interval bisection will branch off operation of each layer down is logn we each point O (1) in each case then as the overall complexity of the number of points together so == n It is the nlogn.

But we only divide and conquer without calculation, then the process of achievements like the tree line every point of the interval then obviously did not look to see that this complexity is a constant time we found that the number of nodes in this binary tree is so complexity is 2n 2n

This is done by the whole complexity. The next observation point source of the complexity of the rule.

First we select the focus at this time to ensure that each subtree are <= half of all the partition of the current node and then the subtree of the partition process is observed only after the recursive logn wherein each layer adds up the number of points when it is equal to the total number of points about each point swept over the time complexity of nlogn

If you add some other operations, then that's the nlogn ^ 2. That focus on the operation before the partition of the specific requirements of the tree do we find the number of points in each layer is n and the current overall demand overall complexity of this layer so the center of gravity for the complexity of O (n) also nlogn.

Consider dotted tree dotted tree is actually put those points can be used as the center of gravity point in the partition connect in some form. We do dynamic modification information when jumping from one node up the complexity of violence and strict logn dotted tree structure out of this complexity is also nlogn. (Of course, I will not write)

Consider how dynamic maintenance of the tree that is the focus of the current tree delete a node plus a plus a son or a node in a tree, so we need to focus LCT dynamic maintenance of the tree, and maintain this thing need to know some knowledge points:

All points to the center of gravity of the center of gravity and the distance <= all point to another point of the tree is a tree re-described center of gravity of the largest subtree of view subtree size <= half of the whole tree from the point of view from the tree with. This is easy to think of the brain make up just fine.

2 Also worth mentioning is the center of the tree has at most two this is also very easy to prove: that we must be a comparison between two nodes on an edge if these two points are the focus when the center of gravity of the comparison of the tree At this time, if the center of gravity consider adding a third additive into two subtrees certain points impossible. Connected to a node of the tree at this time the focus of this node becomes a thought to just add this point as the focus is more than half the size of the sub-tree of the whole, for just another point as well.

Fully focus on tree has at most two. Also has an odd number of nodes in the tree is only one center of gravity.

3 is connected to the two trees obtained a new tree through a certain point, the new center of gravity of the tree is inevitably connected to the center of gravity in the two original tree path.

This is very obvious that if you can not prove it, then people who know me can find me in person to prove dictated more intuitive. Description is not very good.

4 a tree add or delete a node, moving the center of gravity of the tree at most one edge position. This super apparently right.

 

Guess you like

Origin www.cnblogs.com/chdy/p/11345215.html