9. Give an O(n)-time algorithm for computing the depth of all the nodes of a tree T (arbitrary tree), where n is the number of nodes of T. (7 points) Show transcribed image text 9. Give an O(n)-time algorithm for computing the depth of all the nodes of a tree T (arbitrary tree), where n is the number of nodes of T. (7 points)
Solution
Function calculateHeight(root)
BEGIN
// I the tree is empty
If root
OR
OR