Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int depth() {
- if(leftDepth() > rightDepth()) {
- return leftDepth();
- } else {
- return rightDepth();
- }
- }
- public int leftDepth() {
- if(getLeft() == null) {
- return 0;
- } else {
- return 1 + getLeft().depth();
- }
- }
- public int rightDepth() {
- if(getRight() == null) {
- return 0;
- } else {
- return 1 + getRight().depth();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement