Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Boolean RemoveBase(Base *p, int ra) {
- ImplBase aux;
- aux = (ImplBase)*p;
- if(aux == NULL)
- {
- return false;
- }
- if(ra > aux->info.ra)
- {
- return RemoveBase((Base*)&aux->dir, ra);
- }
- if(ra < aux->info.ra)
- {
- return RemoveBase((Base*)&aux->esq, ra);
- }
- if(aux->dir != NULL){
- String infoAux;
- infoAux = aux -> info.nome;
- Aluno a = achaMinimoDir((Base*)&aux->dir);
- aux -> info = a;
- *p = (Base)aux;
- FREE(infoAux);
- return RemoveBase((Base*)&aux->dir, a.ra);
- }
- if(aux->esq !=NULL) {
- String infoAux;
- infoAux = aux -> info.nome;
- *p = aux->esq;
- FREE(aux);
- FREE(infoAux);
- return true;
- }
- FREE(aux->info.nome);
- *p = NULL;
- FREE(aux);
- return true;
- } /* RemoveBase */
Add Comment
Please, Sign In to add comment