-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAVLTrial.java
More file actions
51 lines (31 loc) · 1 KB
/
AVLTrial.java
File metadata and controls
51 lines (31 loc) · 1 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
51
import java.util.Iterator;
public class AVLTrial {
public static void main(String[] args) {
String[] words = {"5", "7" , "8" , "10", "31", "59" , "69"};
AVLTree<String> wordTree = new AVLTree<String>();
for (int i=0; i < words.length; i++) {
wordTree.add(words[i]);
}
System.out.println("Adding another word: ");
wordTree.add("42");
System.out.println(wordTree.contains("42"));
//System.out.println(wordTree.toString());
// System.out.println("Words in the dictionary");
//
//Iterator<String> iter = wordTree.iterator();
//
// while (iter.hasNext()) {
// System.out.println(iter.next() + " ");
// }
// wordTree.remove("cat");
//
// System.out.println("After removing banana");
// Iterator<String> iter2 = wordTree.iterator();
//
// while (iter2.hasNext()) {
// System.out.println(iter2.next() + " ");
// }
// System.out.println(wordTree.toString());
// System.out.println("contains word: " + wordTree.contains("sat"));
}
}