Show that the following algorithm correctly computes the diameter of a tree T: Let u be any vertex in…

Question:

Transcribed Image Text:

Show that the following algorithm correctly computes the diameter of a tree T: Let u be any vertex in T. Use the Breadth-First Search algorithm to find a vertex v at maximum distance from u. Then use Breadth-First Search to find a vertex w at maximum distance from v. Show that the diameter is d(v, w).

Expert Answer: