Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 8, 2020 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/9a42479b391053c2d1d64f49f21fcb3f to your computer and use it in GitHub Desktop.
Save parzibyte/9a42479b391053c2d1d64f49f21fcb3f to your computer and use it in GitHub Desktop.
public boolean existe(int busqueda) {
return existe(this.raiz, busqueda);
}
private boolean existe(Nodo n, int busqueda) {
if (n == null) {
return false;
}
if (n.getDato() == busqueda) {
return true;
} else if (busqueda < n.getDato()) {
return existe(n.getIzquierda(), busqueda);
} else {
return existe(n.getDerecha(), busqueda);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment