Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. Nodo *busca(int valor, Nodo **raiz) {
  2. if(*raiz != NULL) {
  3. (*raiz)->mostra();
  4. cout << "---" << endl;
  5. if(valor == (*raiz)->getValor()) {
  6. cout << "Achei" <<endl;
  7. return * raiz;
  8. }
  9. cout << "chamei direita" << endl;
  10. if((*raiz)->dir != NULL){
  11. return busca(valor, &(*raiz)->dir);
  12. }
  13. cout << "chamei meio" << endl;
  14. if((*raiz)->meio != NULL){
  15. return busca(valor, &(*raiz)->meio);
  16. }
  17. cout << "chamei esq" << endl;
  18. if((*raiz)->esq != NULL){
  19. return busca(valor, &(*raiz)->esq);
  20. }
  21. cout << "PORRRAAAA!!!!" << endl;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement