-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnode.cpp
More file actions
59 lines (56 loc) · 828 Bytes
/
Copy pathnode.cpp
File metadata and controls
59 lines (56 loc) · 828 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
56
57
58
59
#include"node.h"
using namespace std;
int Node::get_x() {
return x;
}
int Node::get_y(){
return y;
}
int Node::get_val(){
return val;
}
Node* Node::getLeftChild(){
return left;
}
Node* Node::getRightChild(){
return right;
}
void Node::set_x(int x_coord){
x = x_coord;
}
void Node::set_y(int y_coord){
y = y_coord;
}
void Node::set_val(int value){
val = value;
}
void Node::set_left(int val){
left = new Node();
left->set_val(val);
}
void Node::set_right(int val){
right = new Node();
right->set_val(val);
}
// bool leftChildExists(Node* node){
// return if(node->getLeftChild);
// }
// bool rightChildExists(Node* node){
// return if(node->getRightChild)
// }
Node::Node()
{
int x=0;
y=0;
val=INT_MIN;
left=NULL;
right=NULL;
}
Node::Node(int val)
{
int x=0;
y=0;
val=INT_MIN;
left=NULL;
right=NULL;
}