예제 #1
0
 //Checks if parameter exists in the tree.
 public bool exists(int number)
 {
     if (this.number == number)
     {
         return(true);
     }
     if (left != null)
     {
         if (left.exists(number))
         {
             return(true);
         }
     }
     if (right != null)
     {
         if (right.exists(number))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
 /**
  * Returns true if the number is present as a node in the tree
  */
 public bool exists(int number)
 {
     return(root.exists(number));
 }