Guest User

Untitled

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. public int depth() {
  2. if (left == null && right == null)
  3. return 0;
  4. else if (left != null && right != null)
  5. return 1 + Math.max(left.depth(), right.depth());
  6. else if (left == null)
  7. return 1 + right.depth();
  8. else
  9. return 1 + left.depth();
  10. }
Add Comment
Please, Sign In to add comment