Skip to content

Commit 725aaa4

Browse files
committed
feat: 이진 트리 구현체 작성
네이밍이 조금 맘에 안들긴 하지만...
1 parent bbfb755 commit 725aaa4

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package tree.binarytree;
2+
3+
public class BinaryTreeNodeImpl<E> implements BinaryTreeNode<E> {
4+
5+
private final E data;
6+
private BinaryTreeNode<E> left;
7+
private BinaryTreeNode<E> right;
8+
9+
public BinaryTreeNodeImpl(E data) {
10+
this.data = data;
11+
}
12+
13+
@Override
14+
public E getData() {
15+
return this.data;
16+
}
17+
18+
@Override
19+
public BinaryTreeNode<E> getLeftSubTree() {
20+
return this.left;
21+
}
22+
23+
@Override
24+
public void setLeftSubTree(BinaryTreeNode<E> subTree) {
25+
this.left = subTree;
26+
}
27+
28+
@Override
29+
public BinaryTreeNode<E> getRightSubTree() {
30+
return this.right;
31+
}
32+
33+
@Override
34+
public void setRightSubTree(BinaryTreeNode<E> subTree) {
35+
this.right = subTree;
36+
}
37+
}

0 commit comments

Comments
 (0)