-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryTreeNode.java
More file actions
57 lines (48 loc) · 1.08 KB
/
BinaryTreeNode.java
File metadata and controls
57 lines (48 loc) · 1.08 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
package datastructures;
/**
* BinaryTreeNode.java
* CS 201
* Heather Pon-Barry
*/
/**
* BinaryTreeNode is the interface for a basic binary tree node, with data of
* type T and pointers to left and right children.
*/
public interface BinaryTreeNode<T> {
/**
* Get the data stored at this node.
*
* @return Object data.
*/
public T getData();
/**
* Set the data stored at this node.
*/
public void setData(T data);
/**
* Get the left child.
*
* @return BinaryTreeNode that is left child, or null if no child.
*/
public BinaryTreeNode<T> getLeftChild();
/**
* Get the right child.
*
* @return BinaryTreeNode that is right child, or null if no child.
*/
public BinaryTreeNode<T> getRightChild();
/**
* Set the left child.
*/
public void setLeftChild(BinaryTreeNode<T> left);
/**
* Set the right child.
*/
public void setRightChild(BinaryTreeNode<T> right);
/**
* Tests if this node is a leaf (has no children).
*
* @return true if leaf node.
*/
public boolean isLeaf();
}