public static int depth (Tree T, Position v) {
    if (T.isRoot(v))
      return 0;
    else
      return 1 + depth(T, T.parent(v));
  }