![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LCA
文章平均质量分 87
和尚洗头用飘柔呐
这个作者很懒,什么都没留下…
展开
-
Closest Common Ancestors(POJ 1470 最近公共祖先)
链式前向星 题目链接 Description Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancestor of u and v in the tr...原创 2018-08-03 09:52:40 · 187 阅读 · 0 评论 -
LCA最近公共祖先(Tarjan离线算法)详解(转)
转自https://www.cnblogs.com/ECJTUACM-873284962/p/6613379.html 首先是最近公共祖先的概念(什么是最近公共祖先?): 在一棵没有环的树上,每个节点肯定有其父亲节点和祖先节点,而最近公共祖先,就是两个节点在这棵树上深度最大的公共的祖先节点。 换句话说,就是两个点在这棵树上距离最近的公共祖先节点。 所以LCA主...转载 2018-08-03 15:48:36 · 130 阅读 · 0 评论