• 树的点分治专题


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

    树的重心

    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即可求得。

    树的重心的性质

    以树的重心为根,则子树的点数不超过 $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

  • 相关阅读:
    stm8s103 EEPROM烧程序时能否保留
    NEC芯片特别说明
    pic中断特别说明
    删除排序链表中的重复元素 II
    被围绕的区域
    计数二进制子串
    简单工厂模式
    打家劫舍 II
    打家劫舍
    相同的树
  • 原文地址:https://www.cnblogs.com/Patt/p/6369924.html
Copyright © 2020-2023  润新知