-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBSTNode.java
More file actions
executable file
·55 lines (45 loc) · 904 Bytes
/
BSTNode.java
File metadata and controls
executable file
·55 lines (45 loc) · 904 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* Represents a generic object used to represent each node in a binary search tree.
*/
public class BSTNode {
/**
* Holds basic integer type.
*/
private int data;
/**
* Object reference to left child.
*/
private BSTNode left;
/**
* Object reference to right child.
*/
private BSTNode right;
/**
* Initializes a new node in the binary search tree.
*
* @param data Integer that initializing node will hold
*/
public BSTNode(int data) {
this.data = data;
left = null;
right = null;
}
public int getData() {
return data;
}
public void setData(int data) {
this.data = data;
}
public BSTNode getLeft() {
return left;
}
public void setLeft(BSTNode left) {
this.left = left;
}
public BSTNode getRight() {
return right;
}
public void setRight(BSTNode right) {
this.right = right;
}
}