-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBTS.java
More file actions
36 lines (22 loc) · 684 Bytes
/
Copy pathBTS.java
File metadata and controls
36 lines (22 loc) · 684 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
import java.util.Iterator;
public class BTS {
public static void main(String[] args) {
Tree tree = new Tree();
//adding value to bianry search tree
tree.add(6);
tree.add(3);
tree.add(2);
tree.add(1);
tree.add(8);
tree.add(25);
tree.add(7);
tree.add(4);
tree.add(5);
BTSIterator bts = new BTSIterator(tree);
System.out.println("Traversing the Binary Search Tree : ");
for(Iterator<Integer> itr = bts.getIterator(); itr.hasNext(); ){
Integer val = itr.next();
System.out.println(val);
}
}
}