随笔分类 - 数据结构 - LCA
摘要:A . After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show during the feast. To enjoy the sh
阅读全文
摘要:You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned t
阅读全文
摘要:There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want
阅读全文
摘要:推荐博客 : http://blog.csdn.net/lw277232240/article/details/72870644 LCA 就是去寻找最近公共祖先 ,如上图中 10 与 11 的LCA是 6 ,7 和 12 的LCA 是 4 。 通过这个我们可以解决的一类问题就是 求任意两点之间的距离
阅读全文