forked from premaseem/AlgorithmAndDataStructureInJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
executable file
·45 lines (30 loc) · 826 Bytes
/
Main.java
File metadata and controls
executable file
·45 lines (30 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package dsGuy.AVLTree;
public class Main {
public static void main(String[] args) {
// Constructor
AVLTree tree = new AVLTree();
// Insert values in AVL Tree
tree.insert(30);
tree.insert(10);
tree.insert(5);
tree.insert(3);
tree.insert(4);
tree.insert(50);
tree.insert(65);
tree.insert(1);
tree.levelOrderTraversal();
tree.printTreeGraphically();
tree.deleteNodeOfBST(5);//LL Condition
tree.printTreeGraphically();
tree.insert(2);
tree.printTreeGraphically();
tree.deleteNodeOfBST(4);//LR Condition
tree.printTreeGraphically();
tree.insert(20);
tree.deleteNodeOfBST(65);//RR Condition
tree.printTreeGraphically();
tree.insert(40);
tree.deleteNodeOfBST(20);//RL Condition
tree.printTreeGraphically();
}// end of method
}// end of class