Skip to content

Project developed on Java that simulate, in a graphical way, how an AVL-TREE works.

License

Notifications You must be signed in to change notification settings

AlexVelezLl/AVL-TREE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AVL TREE

language Codacy Badge repoSize Contributors forks Stargazers Issues lastCommit LinkedIn Twitter

AVL TREE is an application developed on Java that simulate the behavior of an Avl Tree, with the aim of the user learn in a better way how an Avl works.

TheTree

The Tree

The Avl tree is a search binary tree wich we can use to represent information hierarchically. This tree is also self balancing, that means that the tree is always balanced, in such a way that for every node the difference of the heigh of left branch and the heigh of right branch is at most one.

The representation of the avl tree in this application is only to save integers, but in an Avl Tree you can save any data type that can be comparable.

Rules

As freecodecamp 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.

  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).

  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.

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.

Avl-tree 🔥

In this aplication you have three options to experiment with the tree, you have the option to add a new node, the option to remove a node, and you can also clear the tree removing all the nodes of the current tree.

The aplication behind the scenes will aply all the rules and algorithms to keep balanced the tree.

Prerequisites 📋

You should have the java virtual machine installed(JVM) on your computer to run the game, if you do not have the java virtual machine you could install it from here.

Installation 🔧

You only need to download this project. To run the game you need to get into the folder "dist", which is in the root directory, and then execute the "Avl-Tree.jar" file.

Or you can also run this from the shell, you need to cd to the project folder, and then execute:

java -jar dist/Avl-Tree.jar

Built with 🛠️

  • Java8
  • JavaFx

About

Project developed on Java that simulate, in a graphical way, how an AVL-TREE works.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages