algorithm height for computing the height of nonempty tree note that this algorithm calls algorithm depth (code fragment code fragment method height written in java note the use of the max method of class java lang math unfortunatelyalgorithm height is not very efficient since height calls algorithm depth (von each external node of tthe running time of height is given by ( ( ))where is the number of nodes of td is the depth of node vand is the set of external nodes of in the worst casethe sums ( is proportional to (see exercise - thusalgorithm height runs in ( time algorithm height shown in code fragment and implemented in java in code fragment computes the height of tree in more efficient manner by using the recursive definition of height