Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2025 Set 2
Questions

Q49

NAT2 marksAlgorithms

Consider the following algorithm someAlgo that takes an undirected graph GG as input. someAlgo(GG) 1. Let vv be any vertex in GG. Run BFS on GG starting at vv. Let uu be a vertex in GG at maximum distance from vv as given by the BFS. 2. Run BFS on GG again with uu as the starting vertex. Let zz be the vertex at maximum distance from uu as given by the BFS. 3. Output the distance between uu and zz in GG. The output of someAlgo(TT) for the tree shown in the given figure is ___________. (Answer in integer)

Figure 1

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.