Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nodoABB PadreABB (nodoABB n, ABB A)
- {
- if (n == NODO_NULO)
- ERROR("PadreABB: Nodo inexistente");
- if (RaizABB(A) == n)
- ERROR("PadreABB: La raiz no tiene padre");
- return PadreABBaux(n->elto.clave,RaizABB(A));
- }
- static nodoABB PadreABBaux(tClave c, nodoABB n)
- {
- if (n == NODO_NULO)
- return NODO_NULO;
- else
- {
- if (n->hizq != NODO_NULO)
- if (n->hizq->elto.clave == c)
- return n;
- if (n->hder != NODO_NULO)
- if (n->hder->elto.clave == c)
- return n;
- if (n->hizq != NODO_NULO)
- if (n->elto.clave > c)
- return PadreABBaux(c, n->hizq);
- if (n->hder != NODO_NULO)
- if (n->elto.clave < c)
- return PadreABBaux(c, n->hder);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment