Algorithm to find diameter of a tree is :-
) Choose random node s and find farthest node u from s.
2) Find farthest node v from u.
3) d(u,v) is the diameter.
Can someone please explain why this algorithm works ? I tried searching it on Google but was not able to understand the proof.