-
Notifications
You must be signed in to change notification settings - Fork 1
/
Node.h
53 lines (43 loc) · 867 Bytes
/
Node.h
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
#ifndef NODE_H
#define NODE_H
#include <iostream>
#include "NodeInterface.h"
class Node :
public NodeInterface
{
public:
Node * leftChild;
Node * rightChild;
int data;
int height;
Node(int value) {
height = 0;
data = value;
leftChild = NULL;
rightChild = NULL;
}
~Node()
{
}
/*
* Returns the data that is stored in this node
*
* @return the data that is stored in this node.
*/
int getData() const;
/*
* 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.
*/
NodeInterface * getLeftChild() const;
/*
* 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.
*/
NodeInterface * getRightChild() const;
int getHeight();
int getBalance();
};
#endif