-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
63 lines (47 loc) · 1.09 KB
/
Node.java
File metadata and controls
63 lines (47 loc) · 1.09 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
58
59
60
61
62
package com.dataStructure.collections.binaryTree;
public class Node implements Comparable<Node> {
private Integer value;
private Node left;
private Node right;
private Node parent;
public Node() {
this.value = null;
this.left = null;
this.right = null;
this.parent = null;
}
public Node(Integer value) {
this.value = value;
this.left = null;
this.right = null;
this.parent = null;
}
@Override
public int compareTo(Node node) {
return this.value - node.value;
}
public Node getLeft() {
return left;
}
public Node getRight() {
return right;
}
public void setLeft(Node left) {
this.left = left;
}
public void setRight(Node right) {
this.right = right;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public void setParent(Node parent) {
this.parent = parent;
}
public Node getParent() {
return this.parent;
}
}