X323: Binary Tree Get Difference Exercise(Modified)

Given a binary tree, write a recursive function to return the difference between the sum of all node values at odd levels and sum of all node values at even levels. Define the root node to be at level 1.
Here are methods that you can use on the BinNode objects:
   interface BinNode {
      public int value();
      public void setValue(int v);
      public BinNode left();
      public BinNode right();
      public boolean isLeaf();

Your Answer:


Practice a different Java exercise


Your feedback will appear here when you check your answer.