-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeTest.java
More file actions
40 lines (29 loc) · 790 Bytes
/
TreeTest.java
File metadata and controls
40 lines (29 loc) · 790 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
package org.study;
public class TreeTest {
public static void main(String[] args) {
TreeBinarySearch bst = new TreeBinarySearch();
bst.insertBST(1);
bst.insertBST(9);
bst.insertBST(4);
bst.insertBST(5);
bst.insertBST(6);
bst.insertBST(7);
bst.insertBST(2);
bst.insertBST(3);
bst.insertBST(10);
System.out.println("Binary Tree >>>");
bst.printBST();
System.out.println("Is There '90'?>>>");
TreeNode p1 = bst.searchBST(90);
if(p1 != null)
System.out.println(p1.data+" exist");
else
System.out.println("no");
System.out.println("Is There '10'?>>>");
TreeNode p2 = bst.searchBST(10);
if(p2 != null)
System.out.println(p2.data+" exist");
else
System.out.println("no");
}
}