-
Notifications
You must be signed in to change notification settings - Fork 1
/
BST.java
42 lines (36 loc) · 1.06 KB
/
BST.java
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
package data_structures.trees;
/**
* insertion: (log n) Logarithmic
* deletion: (log n) Logarithmic
* retrieval: (log n) Logarithmic
*/
public class BST {
public static void main(String[] args) {
Tree myTree = new Tree();
myTree.insert(24.4);
myTree.insert(20.2);
myTree.insert(11.3);
myTree.insert(11.33);
myTree.insert(0.3324);
myTree.insert(43.545);
myTree.insert(0.001);
myTree.insert(223.3);
myTree.insert(222);
myTree.insert(17.99);
myTree.traversePreOrder();
System.out.println();
myTree.traverseInOrder();
System.out.println();
myTree.traversePostOrder();
System.out.println();
System.out.println(myTree.get(43.545));
System.out.println(myTree.get(9999.999));
System.out.println(myTree.min());
System.out.println(myTree.max());
myTree.delete(0.001);
myTree.traverseInOrder();
myTree.delete(3453453.3);
System.out.println();
myTree.traverseInOrder();
}
}