-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryTreeNode.java
More file actions
37 lines (33 loc) · 901 Bytes
/
Copy pathBinaryTreeNode.java
File metadata and controls
37 lines (33 loc) · 901 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
35
36
37
// Hussein's Binary Tree
// 26 March 2017
// Hussein Suleman
public class BinaryTreeNode<dataType>
{
dataType data;
BinaryTreeNode<dataType> left;
BinaryTreeNode<dataType> right;
int height;
/**
* Construtor to create a node
* @param d contains the key for the node
* @param l contains the left subtree of the node (left node)
* @param r contains the right subtree of the node (right node)
*/
public BinaryTreeNode ( dataType d, BinaryTreeNode<dataType> l, BinaryTreeNode<dataType> r )
{
data = d;
left = l;
right = r;
height = 0;
}
/**
* Method to return the left node.
* @return returns the left node.
*/
BinaryTreeNode<dataType> getLeft () { return left; }
/**
* Method to return the right node.
* @return returns the right node.
*/
BinaryTreeNode<dataType> getRight () { return right; }
}