Concepts2
⚙️AlgorithmIntermediate
Tree Distances and Diameter
Tree diameter is the longest simple path in a tree and can be found with two BFS/DFS runs.
#tree diameter#tree center#eccentricity+12
🗂️Data StructureAdvanced
Centroid Decomposition
Centroid decomposition splits a tree around a special node (centroid) so that every remaining component has at most half the nodes.
#centroid decomposition#centroid tree#tree algorithms+11