external nodes in the left sub-tree and the right sub-tree however if the tree is emptythat is tree nullthen the number of external nodes will be zero but if there is only one node in the treethen the number of external nodes will be one number of external nodes totalexternalnodes(left sub-treetotalexternalnodes (right sub-treeconsider the tree given in fig the total number of external nodes in the given tree can be calculated astotal external nodes of left sub-tree total external nodes of left sub-tree total external nodes of tree totalexternalnodes(treestep if tree null return else if tree -left null and tree -right null return else return totalexternalnodes(tree -lefttotalexternalnodes(tree -right[end of ifstep end figure algorithm to calculate the total number of external nodes in binary search tree tc figure binary search tree and its finding the mirror image of binary search tree mirror image of binary search tree is obtained by interchanging the left sub-tree with the right sub-tree at every node of the tree for examplegiven tree tthe mirror image of can be obtained as tcconsider the tree given in fig figure shows recursive algorithm to obtain the mirror image of binary search tree in the algorithmif tree !nullthat is if the current node in the tree has one or more nodesthen the algorithm is recursively called at every node in the tree to swap the nodes in its left and right sub-trees mirrorimage(treestep if tree !null mirrorimage(tree -leftmirrorimage(tree -rightset temp tree -left set tree -left tree -right set tree -right temp [end of ifstep end figure figure shows recursive algorithm to calculate the total number of external nodes in binary search tree for every nodewe recursively call the algorithm on its left sub-tree as well as the right sub-tree the total number of external nodes at given node is then returned by adding the external nodes in its left as well as right sub-tree however if the tree is emptythat is tree nullthen the number of external nodes will be zero also if there is only one node in the treethen there will be only one external node (that is the root nodealgorithm to obtain the mirror image mirror image tcof binary search tree deleting binary search tree to delete/remove an entire binary search tree from the memorywe first delete the elements/nodes in the left sub-tree and then delete the nodes in the right sub-tree the algorithm shown in fig gives recursive procedure to remove the binary search tree finding the smallest node in binary search tree the very basic property of the binary search tree states that the smaller value will occur in the left sub-tree if