Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1.    public int getAltura() {
  2.        
  3.         if (this.filhoEsquerdo == null && this.filhoDireito == null)
  4.             return 0;
  5.         else {
  6.             if (this.filhoDireito != null && filhoEsquerdo != null){
  7.            
  8.                 if (this.filhoEsquerdo.getAltura() > this.filhoDireito.getAltura())
  9.                     return this.filhoEsquerdo.getAltura() + 1;
  10.                 else
  11.                    return this.filhoDireito.getAltura() + 1;
  12.             } else if (this.filhoDireito == null)
  13.                 return this.filhoEsquerdo.getAltura() + 1;
  14.             else if (this.filhoEsquerdo == null)
  15.                 return this.filhoDireito.getAltura() + 1;
  16.         }
  17.         return -1;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement