How to find both the centroids of a tree?

Правка en1, от Parvej, 2021-04-06 05:13:55

We know that a tree has either 1 or 2 centroids. I can find one centroid using simple dfs.

But, if a tree has 2 centroids, Is there a way to efficiently find the other one?

In case you don't know about centroids of a tree. See here

Теги centroid decomposition, centroid, tree

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Parvej 2021-04-06 05:13:55 364 Initial revision (published)