Пример #1
0
 public int quantFolhas()
 {
     if (esq == null && dir == null)
     {
         return(1);                            // se for nó folha retorna valor 1
     }
     if (esq == null)
     {
         return(dir.quantFolhas());
     }
     if (dir == null)
     {
         return(esq.quantFolhas());
     }
     return(dir.quantFolhas() + esq.quantFolhas()); // soma retornos
 }
Пример #2
0
 public int quantFolhas()
 {
     if (raiz != null)
     {
         return(raiz.quantFolhas());
     }
     else
     {
         return(0);
     }
 }