//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); }
/** * Returns true if the number is present as a node in the tree */ public bool exists(int number) { return(root.exists(number)); }