- indent your code properly (don't mix tabs and spaces)
- don't abbreviate your names and remove the `aux' prefix.
then `aux_hsuc' may become `sucesor' and
`aux_hsucp' will be `padre_del_sucesor'
which makes easier to distinguish and gives them a meaning.
your tests use the `.insertar()' function, ¿why do we care about .remover()?
¿are you using .remover() in your code?
if you want to test `a', then do `a', don't do `xyz_a_zyx' when have no idea if the other functions work.
that said, .remover() is incorrect
you say
hijo = buscar(padre, clave);
however, in buscar() the only time when you don't return NULL is this
1 2 3 4
|
Nodo* buscar(Nodo *&raiz, const T& elem){
aux = raiz;
if (aux->valor == elem)
return aux;
|
when you don't return NULL, you return `raiz', so both `hijo' and `padre' are the same node.
I stopped there as the names were making me dizzy. You'll have to provide a minimal run-able example so we can use a debugger.
> I tried changing my search, delete and succesor searcher to receive both
> &*Nodo, **Nodo and *Nodo as a parameter
don't voodoo code, think on what you are doing and why
almost forgot
1 2
|
borrar_cascada(aux->der);
borrar_cascada(aux->der);
|
note that you kill the right son twice.