All-pairs shortest paths in trees?
Just do a bfs on every node. Every search gives you a fine one-to-all shortest path in the tree.
All in all $n$ times $O(n)$ = $O(n^2)$.
You can also do it in $O(n)$, if you don't mind the distances being stored implicitly (still $O(1)$ lookups): Make an LCA datastructure, and calculate the distances from the root to every node $d(u)$. Then the shortest path between $u$ and $v$ is just $d(u)+d(v)-2d(lca(u,v))$.