-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.java
More file actions
34 lines (28 loc) · 879 Bytes
/
Main.java
File metadata and controls
34 lines (28 loc) · 879 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
package com.dataStructure;
import com.dataStructure.collections.binaryTree.MyBinaryTree;
public class Main {
public static void main(String[] args) {
MyBinaryTree<Integer> tree = new MyBinaryTree<>();
// 예제에 있는 트리와 동일하게 구성
tree.add(23);
tree.add(12);
tree.add(40);
tree.add(7);
tree.add(16);
tree.add(1);
tree.add(14);
tree.add(17);
tree.add(29);
tree.add(55);
tree.add(61);
System.out.print("전위 순회 : ");
tree.preorder(); // 전위 순회
System.out.println();
System.out.print("중위 순회 : ");
tree.inorder(); // 중위 순회
System.out.println();
System.out.print("후위 순회 : ");
tree.postorder(); // 후위 순회
System.out.println();
}
}