string representation of an entire tree let us assume again that for each element stored in tree tcalling tostring(returns string associated with the parenthetic string representation (tof tree is recursively defined as follows if consists of single node vthen (tv element(tostring(otherwisep(tv element(tostring(( ( ",**"" ( +")"where is the root of and are the subtrees rooted at the children of vwhich are given in order if is an ordered tree note that the above definition of (tis recursive alsowe are using "+here to denote string concatenation the parenthetic representation of the tree of figure is shown in figure figure parenthetic representation of the tree of figure indentationline breaks and spaces have been added for clarity note thattechnically speakingthere are some computations that occur between and after the recursive calls at node' children in the above algorithm we still consider this algorithm to be preorder traversalhoweversince the primary action of printing node' contents occurs prior to the recursive calls the java method parentheticrepresentationshown in code fragment is variation of method tostringpreorder (code fragment it implements the definition given above to output parenthetic string representation of tree as with the method tostringpreorderthe method parentheticrepresentation makes use of the tostring method that is defined for every java object in factwe can view this method as kind of tostring(method for tree objects