( rootparent ( children(vo( isinternalisexternalisroot ( tree traversal algorithms in this sectionwe present algorithms for performing traversal computations on tree by accessing it through the tree adt methods depth and height let be node of tree the depth of is the number of ancestors of vexcluding itself for examplein the tree of figure the node storing international has depth note that this definition implies that the depth of the root of is the depth of node can also be recursively defined as followsif is the rootthen the depth of is otherwisethe depth of is one plus the depth of the parent of based on this definitionwe present simplerecursive algorithmdepthin code fragment for computing the depth of node in this method calls itself recursively on the parent of vand adds to the value returned simple java implementation of this algorithm is shown in code fragment code fragment algorithm for computing the depth of node in tree