Java implementation of the AVL tree structure.
Step 1. Add the JitPack repository to your build file:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Step 2. Add the dependency
<dependency>
<groupId>com.github.VEINHORN</groupId>
<artifactId>avl4j</artifactId>
<version>bcef0ad447</version>
</dependency>
AVLTree = new AVLTree();
tree.insert(3);
tree.insert(5);
tree.insert(10);
By default, AVL tree is traversed in order:
tree.traverse();
Using custom consumer:
tree.traverse(TraverseOrder.InOrder, consumer);
Using specific order and custom consumer:
tree.traverse(TraverseOrder.InOrder, consumer);
To delete specific node from the tree, just type:
tree.delete(5);
- https://en.wikipedia.org/wiki/AVL_tree
- https://zhjwpku.com/assets/pdf/AED2-10-avl-paper.pdf
- https://en.wikipedia.org/wiki/Tree_rotation
- https://www.geeksforgeeks.org/avl-tree-set-1-insertion/
- https://www.geeksforgeeks.org/avl-tree-set-2-deletion/
- Lecture 6: AVL Trees, AVL Sort
- https://www.cs.usfca.edu/~galles/visualization/AVLtree.html