-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.cpp
54 lines (46 loc) · 977 Bytes
/
Node.cpp
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
#include "Node.h"
using namespace std;
Node::Node() {
left_child = NULL;
right_child = NULL;
data = 0;
height = 0;
}
Node::~Node() {
left_child = NULL;
right_child = NULL;
data = -1;
height = -1;
}
// ANALYZERS
/*
* Returns the data that is stored in this node
*
* @return the data that is stored in this node.
*/
int Node::getData(){
return data;
}
/*
* Returns the height of this node. The height is the number of edges
* from this node to this nodes farthest child.
*/
int Node::getHeight(){
return height;
}
/*
* Returns the left child of this node or null if it doesn't have one.
*
* @return the left child of this node or null if it doesn't have one.
*/
Node* Node::getLeftChild(){
return left_child;
}
/*
* Returns the right child of this node or null if it doesn't have one.
*
* @return the right child of this node or null if it doesn't have one.
*/
Node* Node::getRightChild(){
return right_child;
}