forked from rbk-org/Java_DataStructures
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaDS.java
More file actions
70 lines (63 loc) · 1.86 KB
/
Copy pathJavaDS.java
File metadata and controls
70 lines (63 loc) · 1.86 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
public class JavaDS {
public static void main(String[] args){
//stack tester
// Stack STACK1;
// STACK1 = new Stack();
// STACK1.push(23);
// STACK1.push(11);
// STACK1.push(2);
// System.out.println("sth");
// STACK1.pop();
// STACK1.pop();
// STACK1.pop();
// STACK1.pop();
// queue tester
// Queue QUEUE1;
// QUEUE1 = new Queue();
// QUEUE1.push(23);
// QUEUE1.push(11);
// QUEUE1.push(2);
// QUEUE1.push(7);
//
// QUEUE1.display();
// QUEUE1.pop();
// QUEUE1.display();
// QUEUE1.pop();
// QUEUE1.display();
// QUEUE1.pop();
// QUEUE1.display();
// QUEUE1.push(23);
// QUEUE1.display();
//
//
// //linkedlist teseter
// LinkedList list = new LinkedList();
// list.addToTail(5);
// list.addToTail(2);
// list.addToTail(-2);
// System.out.println(list.removeHead()+ " Is the head, and it's been removed");
//// System.out.println(list.getHead()+" This is the new head");
// list.addToTail(3);
// list.addToTail(1000);
// System.out.println(list.contains(1000));
//
// //tree tester
Tree tree = new Tree();
int[] items = {5, 8, 7, 1, 9, 3, 0, 4, 6, 2};
for (int i : items)
tree.addChild(i);
System.out.println("Is it contain 3: " + tree.contains(4));
System.out.println("Is it contain 3: " + tree.contains(100));
// tree.display();
//
//
// //hashtable tester
// HashTable hashTable = new HashTable();
// // Put some key values.
// hashTable.insert("cat","1");
// hashTable.insert("cat","2");
// hashTable.insert("dog","3");
// hashTable.remove("cat");
// System.out.println(hashTable.retrieve("dog"));
}
}