Question: A tree is defined as a connected, undirected graph without any cycle. It is obvious that there is a single, unique path between any two

A tree is defined as a connected, undirected graph without any cycle. It is
obvious that there is a single, unique path between any two vertices in a tree. Let T=(V,E) be
a tree and let (u,v) be the length of the path between u and v. We aim to design an algorithm
to find the length of the longest path in T, i.e.,maxu,vinV(u,v). If (u',v') reaches this maximum,
i.e.,(u',v')=maxu,vinV(u,v), we say (u',v') forms a furthest pair. Note that T may contain
multiple furthest pairs.
a. For any vertex uinV, we say v' is the furthest vertex to u, if (u,v')=
maxvinV(u,v). Prove that, for any vertex uinV with v' being (any one of) its further vertex,
there must exist vertex u' such that (u',v') is one furthest pair of T.
b. Given T, design an algorithm to find a further pair and analyze its running time.
Your algorithm should run in O(|V|+|E|) time. (Hint: consider using the results of part (a)
and BFS.)
A tree is defined as a connected, undirected

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!