Skip to content

Commit

Permalink
Merge branch 'master' into App
Browse files Browse the repository at this point in the history
* master:
  Fix bug al eliminar menor de los mayoree
  Change stuff
  Update readme with Codacy revision
  Fix Issues, remove Test
  • Loading branch information
AlexVelezLl committed May 16, 2020
2 parents dfae247 + 9372b7e commit ca03fb1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 406 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ The representation of the avl tree in this application is only to save integers,

As [freecodecamp](https://www.freecodecamp.org/news/avl-tree-insertion-rotation-and-balance-factor/) describes, a search binary tree is a TDA composed of nodes that have the following rules:

1. Each has a root node at the top.
1. Each has a root node at the top.

2. Every node has at the most, two children.
2. Every node has at the most, two children.

3. Every node has only one parent (the root is the one node that has no parents).
3. Every node has only one parent (the root is the one node that has no parents).

4. For each node, its left child is less or equal than the node, wich is less or equal than its right child.
4. For each node, its left child is less or equal than the node, wich is less or equal than its right child.

And the Avl tree has additionally this rule:

1.- The difference between the depth of right and left subtrees cannot be more than one. In order to maintain this guarantee, an implementation of an AVL will include an algorithm to rebalance the tree when adding an additional element would upset this guarantee.
1. The difference between the depth of right and left subtrees cannot be more than one. In order to maintain this guarantee, an implementation of an AVL will include an algorithm to rebalance the tree when adding an additional element would upset this guarantee.

There are several algotihm to aim that, a few of these are: LL rotation, RR rotation, LR rotation and RL rotation, you can watch all these algorithsm to balance the tree in this [video](https://www.youtube.com/watch?v=7m94k2Qhg68).

Expand Down Expand Up @@ -67,7 +67,7 @@ java -jar dist/Avl-Tree.jar

[language-shield]: https://img.shields.io/badge/Java-v1.8.0-blue?style=plastic
[language-url]: https://www.java.com/es/download/
[codacybadge-shield]: https://img.shields.io/codacy/grade/3c17ebf7c1954006a60b08b8af2c58e2?style=plastic
[codacybadge-shield]: https://img.shields.io/codacy/grade/4514b80a741147ba9cf70541aca4a806?style=plastic
[codacybadge-url]: https://www.codacy.com/manual/AlexVelezLl/AVL-TREE?utm_source=github.com&utm_medium=referral&utm_content=AlexVelezLl/AVL-TREE&utm_campaign=Badge_Grade
[repoSize-shield]: https://img.shields.io/github/repo-size/AlexVelezLl/AVL-TREE?style=plastic
[repo]: https://github.com/AlexVelezLl/AVL-TREE
Expand Down
4 changes: 2 additions & 2 deletions src/Interfaz/InterfazArbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

/**
*
* @author CORE i7 ULTIMATE
* @author AlexVelezLl
*/
public class InterfazArbol {
private Pane root;
private AVL<Integer> avlTree;
private ScrollPane sp;
private final TextField txtInsertar;
private final TextField txtDelete;
StackPane arbol;
private StackPane arbol;

public InterfazArbol() {
root = new VBox();
Expand Down
6 changes: 5 additions & 1 deletion src/tda/AVL.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,10 @@ private boolean idexOutOfBoundsException(final Pane vb, final int n) {

// EX remove
public boolean delete(final Object o) throws ClassCastException, NullPointerException {
Nodo<E> borrar = null, mirar = null, cambiar = null, nPadre = null;
Nodo<E> borrar = null;
Nodo<E> mirar = null;
Nodo<E> cambiar = null;
Nodo<E> nPadre = null;
Nodo<E> raizTmp = this.getRoot();
E c_aux;
boolean salir = false;
Expand Down Expand Up @@ -596,6 +599,7 @@ else if (borrar.getRight() != null) {
cambiar.setData(cambiar.getRight().getData());
cambiar.setRight(null);
}
borrar.setData(c_aux);
}

else {
Expand Down
Loading

0 comments on commit ca03fb1

Please sign in to comment.