+1 (218) 451-4151
glass
pen
clip
papers
heaphones

Let T be a binary tree with n positions, and, for any position p in T, let dp denote the depth of…

Let T be a binary tree with n positions, and, for any position p in T, let dp denote the depth of…

Let T be a binary tree with n positions, and, for any position p in T, let dp denote the depth of p in T. The distance between two positions p and q in T is dp + dq − 2da, where a is the lowest common ancestor (LCA) of p and q. The diameter of T is the maximum distance between two positions in T. Describe an efficient algorithm for finding the diameter of T. What is the running time of your algorithm?