Suppose you work for a company, iPilgrim.com, whose n employees are organized in a tree T, so
Question:
Suppose you work for a company, iPilgrim.com, whose n employees are organized in a tree T, so that each node is associated with an employee and each employee is considered a supervisor for all the employees (including themselves) in his or her subtree in T, as in the previous exercise. Furthermore, suppose that communication in iPilgrim is done the “old fashioned” way, where, for an employee, x, to send a message to an employee, y, x must route this message up to a lowest-level common supervisor of x and y, who then routes this message down to y. The problem is to design an algorithm for finding the length of a longest route that any message must travel in iPilgrim.com. That is, 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 + dω − 2du, where u is the LCA u of v and w (as defined in the previous exercise). The diameter of T is the maximum distance between two nodes in T. Thus, the length of a longest route that any message must travel in iPilgrim.com is equal to the diameter of T.
Describe an efficient algorithm for finding the diameter of T. What is the running time of your method?
Step by Step Answer:
Algorithm Design And Applications
ISBN: 9781118335918
1st Edition
Authors: Michael T. Goodrich, Roberto Tamassia