Question: For this question, you are to implement a method called getSize that takes first node in a binary tree (its root) and returns the number

For this question, you are to implement a method called getSize that takes first node in a binary tree (its root) and returns the number of nodes in the tree. public c l a s s BinaryNode { p r i v a t e BinaryNode l e f t , r i g h t ; p r i v a t e T element ; public BinaryNode (T elem) { l e f t = r i g h t = n u l l ; element = elem ; } public BinaryNode g e tLe f t ( ) { r e turn l e f t ; } public void setLeft (BinaryNode node ) { l e f t = node ; } public BinaryNode ge tRight ( ) { r e turn r i g h t ; } public void setRight (BinaryNode node ) { l e f t = r i g h t ; } public T getElement ( ) { r e turn element ; } public void setElement (T elem) { element = elem ; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!