树的点分治专题

树的点分治(以下简称“点分治”)算法同后缀数组一样,也是很早就接触但几乎没练过的算法。此专题总结一下过去遇到的若干树的点分治题目。

树的重心

SGU #134 Centroid的题面给出了树的重心(centroid(s) of a tree)的定义:

Given a tree with $N$ vertices, in order to define the centroid, some integer value will be assosciated to every vertex. Let's consider the vertex $k$. If we remove the vertex $k$ from the tree (along with its adjacent edges), the remaining graph will have only $N-1$ vertices and may be composed of more than one connected components. Each of these components is (obviously) a tree. The value associated to vertex $k$ is the largest number of vertices contained by some connected component in the remaining graph, after the removal of vertex $k$. All the vertices for which the associated value is minimum are considered centroids.

简言之即:树中一点,删去它后所得若干棵树的节点数的最大值最小。
树的重心通过简单的DP即可求得。

树的重心的性质 $\DeclareMathOperator{\size}{size}$

以树的重心为根,则子树的点数不超过 $\frac{N}{2}$ 。

证明:将重心记为 $u$,取 $u$ 的某个儿子 $v$,子树 $v$ 的点数记为 $\size(v)$ 。若 $\size(v) > \frac N2$,则以点 $v$ 为根,所有子树的点数最大值将不超过 $\max\{ \size(v) - 1, N - \size(v)\}< \size(v)$,这意味着 $u$ 并不是树的重心。证毕。

注:上述 $\frac N2$ 是在实数下的除法,不是按某种规则取整之后的。

Exercise

转载于:https://www.cnblogs.com/Patt/p/6369924.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值