Question: Answer the following question. 10. Given the code snippet below, the method findSum adds together all values within the binary search tree and returns the

Answer the following question.

Answer the following question. 10. Given the code snippet below, the method

10. Given the code snippet below, the method "findSum" adds together all values within the binary search tree and returns the total sum. Does this method work as described and if so, what is the resulting value if we use the tree from Question 7? If the method does not work as described, then detail all syntax, run-time, and logic errors and how they may be fixed. (10pts) private class Node private double data; private Node leftChild; private Node rightChild; public Node (double aData) data = aData; leftChild = rightChild = null; private Node root; public double findSum( ) return findSum ( ) ; private double findSum(Node aNode) if (aNode == null) return 0; return aNode. data + findSum(aNode. leftChild) + findSum(aNode. leftChild)

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 Programming Questions!