7.7.2. Binary Tree Set Depth Exercise

Source
https://opendsa-server.cs.vt.edu/ODSA/Books/CS3/html/BinaryTreeInfFlw.html#binary-tree-set-depth-exercise

X281: Binary Tree Set Depth Exercise

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 BTsetdepthdepth 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();
   }