Problem 3. [25 pts] [Centroid] The centroid of a tree is a node that, if removed, splits the tree into connected compone
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Problem 3. [25 pts] [Centroid] The centroid of a tree is a node that, if removed, splits the tree into connected compone
Problem 3. [25 pts] [Centroid] The centroid of a tree is a node that, if removed, splits the tree into connected components each of size no greater than V/2. The following algorithm can be used to find the centroid of a tree T: 1. Let v be an arbitrary vertex of T 2. Let {C₁, C₂,..., C₁} be the connected components of T - {v} 3. Let Ck be the component of maximum size among C₁, 1 ≤ i ≤l 4. If Ck ≤ V/2, return v and terminate 5. Else, let v' be the member of Ck that is a neighbour of v 6. Go back to step 2, with v = v' Prove that the algorithm above always terminates and thus, finds the centroid of the tree.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!