Skip to content

Commit 82e2132

Browse files
authored
Update AVLSimple
1 parent f710f3a commit 82e2132

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

DataStructures/Trees/AVLSimple

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
2+
package DataStructures.Trees;
3+
4+
/*
5+
* Avl is algo that balance itself while adding new alues to tree
6+
* by rotating branches of binary tree and make itself Binary seaarch tree
7+
* there are four cases which has to tackle
8+
* rotating - left right ,left left,right right,right left
9+
10+
Test Case:
11+
12+
AVLTree tree=new AVLTree();
13+
tree.insert(20);
14+
tree.insert(25);
15+
tree.insert(30);
16+
tree.insert(10);
17+
tree.insert(5);
18+
tree.insert(15);
19+
tree.insert(27);
20+
tree.insert(19);
21+
tree.insert(16);
22+
23+
tree.display();
24+
25+
26+
27+
28+
*/
29+
30+
31+
132
public class AVLTree {
233
private class Node{
334
int data;

0 commit comments

Comments
 (0)