-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.java
More file actions
51 lines (41 loc) · 1.48 KB
/
App.java
File metadata and controls
51 lines (41 loc) · 1.48 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
package org.dfpl.lecture.database.assignment2.assignment2_20011727;
import java.util.ArrayList;
import java.util.Iterator;
@SuppressWarnings("unused")
public class App {
public static void main(String[] args) {
System.out.println("Assignment 4: ");
// 평가에서는 m (>=3), c1, c2, c3를 수정하여 수행한다.
int m = 6;
int c1 = 11;
int c2 = 22;
int c3 = 22;
MyBPlusTree bpTree = new MyBPlusTree(m);
for (int i = 1; i <= c3; i++) {
bpTree.add(i);
}
MyBPlusTreeNode n1 = bpTree.getNode(c1);
System.out.println();
MyBPlusTreeNode n2 = bpTree.getNode(c2);
System.out.println();
// 학습적인 의미에서 재귀적으로 inorder traversal 하여 구현해야 함.
bpTree.inorderTraverse();
System.out.println("Assignment 5: ");
ArrayList<Integer> values = new ArrayList<Integer>();
Iterator<Integer> iterator = bpTree.iterator(); // inorder traversal
while(iterator.hasNext()) { // iterator test
Integer value = iterator.next(); // iterator test
values.add(value);
}
System.out.println("iterator test: " + (c3 == bpTree.size()));
System.out.println("Original Tree Structre:");
bpTree.printTreeStructure();
for(Integer value: values) { // contains test
System.out.println(value + " removed start");
bpTree.remove(value);
bpTree.printTreeStructure();
System.out.println("====================================");
}
System.out.println("remove test: " + (bpTree.size() == 0));
}
}