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 be
a tree and let be the length of the path between and We aim to design an algorithm
to find the length of the longest path in ie If reaches this maximum,
ie we say forms a furthest pair. Note that may contain
multiple furthest pairs.
a For any vertex uinV, we say is the furthest vertex to if
Prove that, for any vertex uinV with being any one of its further vertex,
there must exist vertex such that is one furthest pair of
b Given design an algorithm to find a further pair and analyze its running time.
Your algorithm should run in time. Hint: consider using the results of part a
and BFS
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
