Let $T(V, E)$ be a tree given as an adjacency list. For vertices $u, v \in V$, let $d(u, v)$ denote the length of the path from $u$ to $v$ in $T$. Give a linear-time algorithm to determine the value $max_{u,v \in V} d(u, v)$.
Posted: Jul 10 '12
Seen: 65 times
Last updated: Jul 11 '12
Linear time algorithms on trees
Top K elements in a read only array