recategorized by
3,824 views
29 votes
29 votes

Let $T$ be a tree of $n$ nodes. Consider the following algorithm, that constructs a sequence of leaves $u_{1}, u_{2}...$. Let $u_{1}$ be some leaf of tree. Let $u_{2}$be a leaf that is farthest from $u_{1}$. Let $u_{3}$ be the leaf that is farthest from $u_{2}$, and, in general, let $u_{i+1}$ be a leaf of $T$ that is farthest from $u_{i}$ (if there are many choices for $u_{i+1}$, pick one arbitrarily). The algorithm stops when some $u_{i}$ is visited again. What can u say about the distance between $u_{i}$ and $u_{i+1}$, as $i = 1, 2,...?$

  1. For some trees, the distance strictly reduces in each step.
  2. For some trees, the distance increases initially and then decreases.
  3. For all trees, the path connecting $u_{2}$ and $u_{3}$ is a longest path in the tree.
  4. For some trees, the distance reduces initially, but then stays constant.
  5. For the same tree, the distance between the last two vertices visited can be different, based on the choice of the first leaf $u_{1}$.
recategorized by

8 Answers

1 votes
1 votes

Hi Guys,

If question asks which of the following option is false then option  (C) is false rest all are true. Following is my explanation (with the help of examples) for the different parts of this question.

edited by
1 votes
1 votes
The distance remains constant, it can never increase or decrease, as in the algorithm it is said that u1 is at farthest distance from u2 and if there is no such u3, then there is no other vertex which is farthest from u1, and we reach back to u1, the algorithm stops. If there is a u3 then u2-u3 will be a longest path in the tree.

option C.
0 votes
0 votes

Correct option is (C) The path connecting U2 and U3 is a longest path in the tree.

Because, problem is based on diameter of the tree, the diameter of the tree is defined as a longest path or route between any two nodes in a tree and question itself says that leaf ui is farthest from leaf ui+1. 

Question also gives the stopping condition of algorithm that "The algorithm stops when some ui is visited again."

Once diameter is found, if we try to find diameter again and again we can visit the same ui again hence the stopping condition of algo.

 

0 votes
0 votes

Answer should be option C as distance between starting leaf and the last leaf will always be the largest path.

Answer:

Related questions

8 votes
8 votes
2 answers
2
makhdoom ghaya asked Oct 30, 2015
1,826 views
Consider the differential equation $dx/dt= \left(1 - x\right)\left(2 - x\right)\left(3 - x\right)$. Which of its equilibria is unstable?$x=0$$x=1$$x=2$$x=3$None of the ab...