forked from IvanLu1024/Java-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
50 lines (46 loc) · 1.17 KB
/
Main.java
File metadata and controls
50 lines (46 loc) · 1.17 KB
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
46
47
48
49
50
package code_04_bst;
/**
* Created by 18351 on 2018/12/19.
*/
public class Main {
public static void main(String[] args) {
BST<Integer> bst=new BST<>();
int[] nums={5,3,6,8,4,2};
for(int num:nums){
bst.add(num);
}
/**
* 5
* / \
* 3 6
* / \ \
* 2 4 8
*/
/* bst.preOrder();
System.out.println();
bst.preOrderNR();
System.out.println("=====================");
//bst.inOrder();
//System.out.println();
bst.inOrder();
System.out.println();
bst.inOrderNR();
System.out.println("=====================");
bst.postOrder();
System.out.println();
bst.postOrderNR();
//System.out.println(bst);
System.out.println(bst.min());
System.out.println(bst.max());*/
bst.levelOrder();
System.out.println();
bst.delMin();
System.out.println(bst);
bst.delMin();
System.out.println(bst);
bst.delMax();
System.out.println(bst);
bst.del(5);
System.out.println(bst);
}
}