Skip to content

Commit

Permalink
Change stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed May 16, 2020
1 parent 62ef2d4 commit def989e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/tda/AVL.java
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ else if (borrar.getRight() != null) {
altIzq = mirar.getLeft().getAltura();
}

final Nodo<E> cambiar2 = estructurar(mirar, altDer);
final Nodo<E> cambiar2 = estructurar(mirar, altIzq, altDer);
final Nodo<E> superior = padre(mirar);

if (compararDato(superior.getData(), mirar.getData()) != 0) {
Expand Down Expand Up @@ -732,31 +732,30 @@ public int equilibrado(final Nodo<E> n) {
return Math.max(hIzq, hDer) + 1;
}

private Nodo<E> estructurar(final Nodo<E> nodo, final int altDer) {
Nodo<E> nodoTemp = nodo;
if (extraeFactorE(nodoTemp) == 2) {
if (extraeFactorE(nodoTemp.getRight()) == 1 || extraeFactorE(nodoTemp.getRight()) == 0) {
private Nodo<E> estructurar(Nodo<E> nodo, final int altIzq, final int altDer) {
if (extraeFactorE(nodo) == 2) {
if (extraeFactorE(nodo.getRight()) == 1 || extraeFactorE(nodo.getRight()) == 0) {
// nodo = rotacionSimpleIzquierda1(nodo);
nodoTemp = rotacionSimpleIzquierda(nodoTemp);
nodo = rotacionSimpleIzquierda(nodo);
}

else if (extraeFactorE(nodoTemp.getRight()) == -1) {
else if (extraeFactorE(nodo.getRight()) == -1) {
// nodo = rotacionCompuestaDerecha(nodo);
nodoTemp = rotacionDobleDerecha(nodoTemp);
nodo = rotacionDobleDerecha(nodo);
}
} else if (extraeFactorE(nodoTemp) == -2) {
if (extraeFactorE(nodoTemp.getLeft()) == -1 || extraeFactorE(nodoTemp.getRight()) == 0) {
} else if (extraeFactorE(nodo) == -2) {
if (extraeFactorE(nodo.getLeft()) == -1 || extraeFactorE(nodo.getRight()) == 0) {
// nodo = rotacionSimpleDerecha1(nodo);
nodoTemp = rotacionSimpleDerecha(nodoTemp);
nodo = rotacionSimpleDerecha(nodo);
}

else if (extraeFactorE(nodo.getLeft()) == 1) {
// nodo = rotacionCompuestaIzquierda(nodo);
nodoTemp = rotacionDobleIzquierda(nodoTemp);
nodo = rotacionDobleIzquierda(nodo);
}
}

return nodoTemp;
return nodo;
}

/*
Expand Down

0 comments on commit def989e

Please sign in to comment.