chap binary trees /*adt for binary tree nodes *public interface binnode /*return and set the element value *public element()public void setelement( )/*return the left child *public binnode left()/*return the right child *public binnode right()/*return true if this is leaf node *public boolean isleaf()figure binary tree node adt aspects of binary trees that are relevant to all applications for examplewe must be able to initialize binary treeand we might wish to determine if the tree is empty some activities might be unique to the application for examplewe might wish to combine two binary trees by making their roots be the children of new root node other activities are centered around the nodes for examplewe might need access to the left or right child of nodeor to the node' data value clearly there are activities that relate to nodes ( reach node' child or get node' value)and activities that relate to trees ( tree initializationthis indicates that nodes and trees should be implemented as separate classes for nowwe concentrate on the class to implement binary tree nodes this class will be used by some of the binary tree structures presented later figure shows an adt for binary tree nodescalled binnode class binnode is generic with parameter ewhich is the type for the data record stored in node member functions are provided that set or return the element valueset or return reference to the left childset or return reference to the right childor indicate whether the node is leaf binary tree traversals often we wish to process binary tree by "visitingeach of its nodeseach time performing specific action such as printing the contents of the node any process for visiting all of the nodes in some order is called traversal any traversal that lists every node in the tree exactly once is called an enumeration of the tree' nodes some applications do not require that the nodes be visited in any particular order as long as each node is visited precisely once for other applicationsnodes