Problem
Let T be a binary tree with n nodes, and, for any node v in T, let dv denote the depth of v in T. The distance between two nodes v and w in T is dv + dw - 2du, where u is the lowest common ancestor (LCA) u of v and w. The diameter of T is the maximum distance between two nodes in T. Describe an efficient algorithm for finding the diameter of T. What is the running time of your algorithm?