Consider the following definition of IntTreeNode and IntTree, a binary search tr
ID: 3848397 • Letter: C
Question
Consider the following definition of IntTreeNode and IntTree, a binary search tree of integers which includes an add method, a "rotate your head left 90 degrees" print method like the one shown in class, and a launcher for a recursive size method for IntTree. The size method should print the number of nodes in the tree (an empty tree has 0 nodes). Please select a working size method for IntTree. An example main method is provided with the correct value in a comment. Explain why please!
private int size(IntTreeNode node) { return node.left + node.right; }
Explanation / Answer
working size method for IntTree is that,
This retuens the total size of both left and right nodes based on condition.