Added functions to get the depth of a tree and calculate the base of an exponent.