/*print the tree contents in sorted order *void printtreeostream out cout const ifisemptyout <"empty tree<endlelse printtreerootout )/*internal method to print subtree rooted at in sorted order *void printtreebinarynode *tostream out const ift !nullptr printtreet->leftout )out element <endlprinttreet->rightout )figure routine to print binary search tree in order /*internal method to compute the height of subtree rooted at *int heightbinarynode * ift =nullptr return - else return maxheightt->left )heightt->right )figure routine to compute the height of tree using postorder traversal the third popular traversal scheme that we have seen is preorder traversal herethe node is processed before the children this could be usefulfor exampleif you wanted to label each node with its depth the common idea in all of these routines is that you handle the nullptr case first and then the rest notice the lack of extraneous variables these routines pass only the pointer