Help me out in this problem


can anyone tell me how to approach ?

@shivammishra20121999

// Since we need to find the MHT roots, we can think of it as finding
        // the nodes which are sort of in the middle of the graph and not near
        // the corners. If a node is near a corner and picked as a root
        // then for it the height will include all the nodes which come on the way from
        // another extreme point. Like if a leaf node is picked then height is taken all the 
        // way from root in a normal binary tree, but if we pick a node in level 2 in a 3 level tree
        // then the chances of it having least height decreases, so we need to find the 
        // nodes which lie in a mid point distance of max distance.
        //            1
        //         2     3
        //        4  5  6 7,     if 4,5,6 or 7 is picked h = 5, 2 and 3 gives h=4, whereas 1 gives h=3 
        
        // find the indegree of each node and use BFS to get to the nodes connected in a central position
        // So naturally it all starts with leaf nodes, remove them in each iteration to get to the central ones

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.