7.7.11. Binary Tree Get Difference Exercise
Source
https://opendsa-server.cs.vt.edu/ODSA/Books/CS3/html/BinaryTreeInfFlw.html#binary-tree-get-difference-exercise
https://opendsa-server.cs.vt.edu/ODSA/Books/CS3/html/BinaryTreeInfFlw.html#binary-tree-get-difference-exercise
X290: Binary Tree Get Difference Exercise
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
interface BinNode {
public int value();
public void setValue(int v);
public BinNode left();
public BinNode right();
public boolean isLeaf();
}
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();
}