Question: JAVA 18. Suppose IntBTNode is a BTNode (from Chapter 9) with integer data. Write a new static method of the IntBTNode class to meet the
JAVA
18. Suppose IntBTNode is a BTNode (from Chapter 9) with integer data. Write a new static method of the IntBTNode class to meet the following specification. public static int sum(IntBTNode root) // Precondition: root is the root reference of a binary tree. // Postcondition: The return value is the sum of all the data in all the nodes. // NOTES: The return value for the empty tree is zero.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
