Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class Tipo>
- bool ArbolAVL<Tipo>::Buscar(const Tipo& ElementoABuscar) const
- {
- NodoAVL<Tipo> *actual;
- bool encontro = false;
- if (raiz == NULL)
- cout << "No puede buscar en un arbol vacio" << endl;
- else
- {
- actual = raiz;
- while (actual != NULL && !encontro)
- {
- if (actual->informacion() == ElementoABuscar)
- encontro = true;
- else
- {
- if (actual->informacion() > ElementoABuscar)
- actual = actual->ligaizquierda();
- else
- actual = actual->ligaderecha();
- }
- }
- }
- return encontro;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement