X328: Binary Tree Set Depth Exercise (Modified)

Write a recursive function to set the value for each node in a binary tree to be its depth then return the modified tree. Assume that nodes store integer values. On the initial call to BTsetdepth, depth is 0.
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();
   }

Reset

Practice a different Java exercise