arnab2001 / DSA

Collection of DSA problems and solutions
37 stars 186 forks source link

Create Finding a Centroid.cpp #372

Open 4d4r5h opened 1 year ago

4d4r5h commented 1 year ago

Given a tree of n nodes, our task is to find a centroid, i.e., a node such that when it is appointed the root of the tree, each subtree has at most ⌊n/2⌋ nodes.

Finding a Centroid (CSES)