sec binary tree traversals must be visited in an order that preserves some relationship for examplewe might wish to make sure that we visit any given node before we visit its children this is called preorder traversal example the preorder enumeration for the tree of figure is abdcegfhi the first node printed is the root then all nodes of the left subtree are printed (in preorderbefore any node of the right subtree alternativelywe might wish to visit each node only after we visit its children (and their subtreesfor examplethis would be necessary if we wish to return all nodes in the tree to free store we would like to delete the children of node before deleting the node itself but to do that requires that the children' children be deleted firstand so on this is called postorder traversal example the postorder enumeration for the binary tree of figure is dbgehifca an inorder traversal first visits the left child (including its entire subtree)then visits the nodeand finally visits the right child (including its entire subtreethe binary search tree of section makes use of this traversal example the inorder enumeration for the binary tree of figure is bdagechfi traversal routine is naturally written as recursive function its input parameter is pointer to node which we will call root because each node can be viewed as the root of some subtree the initial call to the traversal function passes in pointer to the root node of the tree the traversal function visits root and its children (if anyin the desired order for examplea preorder traversal specifies that root be visited before its children this can easily be implemented as follows void preorder(binnode rt/rt is the root of the subtree if (rt =nullreturn/empty subtree visit(rt)preorder(rt left())preorder(rt right())