Guest User

Untitled

a guest
Dec 10th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Boolean RemoveBase(Base *p, int ra) {
  2.  
  3.  
  4. ImplBase aux;
  5. aux = (ImplBase)*p;
  6.  
  7. if(aux == NULL)
  8. {
  9. return false;
  10. }
  11. if(ra > aux->info.ra)
  12. {
  13.  
  14. return RemoveBase((Base*)&aux->dir, ra);
  15. }
  16. if(ra < aux->info.ra)
  17. {
  18.  
  19. return RemoveBase((Base*)&aux->esq, ra);
  20. }
  21.  
  22. if(aux->dir != NULL){
  23. String infoAux;
  24. infoAux = aux -> info.nome;
  25. Aluno a = achaMinimoDir((Base*)&aux->dir);
  26.  
  27. aux -> info = a;
  28. *p = (Base)aux;
  29. FREE(infoAux);
  30. return RemoveBase((Base*)&aux->dir, a.ra);
  31.  
  32. }
  33.  
  34. if(aux->esq !=NULL) {
  35. String infoAux;
  36. infoAux = aux -> info.nome;
  37. *p = aux->esq;
  38. FREE(aux);
  39. FREE(infoAux);
  40. return true;
  41. }
  42. FREE(aux->info.nome);
  43. *p = NULL;
  44. FREE(aux);
  45. return true;
  46.  
  47.  
  48. } /* RemoveBase */
Add Comment
Please, Sign In to add comment