I asked this yesterday, but I am still completely lost and confused. I am trying to write two methods, a wrapper method and a recursive auxiliary method, named `sigma()`

, defined as follows:

```
/**
* A wrapper method for a method that computes the
* sum of the differential keys of this binary search tree.
* @return the sum of the differential keys of this tree.
*/
@Override
public int sigma()
{
if (size == 0)
return 0;
if (root.data.getClass() != Integer.class)
throw new IllegalArgumentException("Keys must be integers");
return (Integer)root.data + sigma(root);
}
/**
* An auxiliary method that recursively computes the sum of
* differential keys in the subtrees of the tree rooted at
* the specified key.
* @param subtreeRoot the root of a subtree of this tree
* @return the sum of the differential keys of the left and
* right subtrees
*/
private int sigma(Node subtreeRoot)
{
// My attempt at implementing the auxiliary method
if(subtreeRoot == null) return 0;
return sigma(subtreeRoot.left) - (Integer)subtreeRoot.data +
sigma(subtreeRoot.right) - (Integer)subtreeRoot.data;
}
```

**Note:** We are not allowed to add any parameters to either method or modify the code inside of the wrapper method.

The definition of a differential key:

Definition 1.The differential key of a node in a binary tree whose elements are integers is the element in the node if the node is the root or is the difference between the element in the node and its parent. The differential of anullnode is 0.

I have covered the base case, `if(subtreeRoot == null) return 0;`

, but after that I am confused.
Here is an example of what the method should do:

The auxiliary method should return the value of the sum of all the differential keys in the BST (-1 in this example), then the wrapper method adds that value to the value of the root node (10 in this example). So the sum of the differential keys and the value returned by sigma() is 10 + (-1) = 9.

The main problem I am having is implementing a recursive solution in the auxiliary method. I can trace the solution out on paper easily, but I cannot seem to implement this into my project. I have not been able to find any resources online about this and my professor is of little help. My attempt at implementing the auxiliary method is included in the code above. Any help is appreciated.