-
Notifications
You must be signed in to change notification settings - Fork 1
/
NodeInterface.h
45 lines (39 loc) · 1.2 KB
/
NodeInterface.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
//YOU MAY NOT MODIFY THIS DOCUMENT
/*
*/
#pragma once
using namespace std;
class NodeInterface {
public:
NodeInterface() {}
virtual ~NodeInterface() {}
/*
* Returns the data stored in this node
*
* @return the data stored in this node.
*/
virtual int getData() const = 0;
/*
* Returns the left child of this node or null if empty left child.
*
* @return the left child of this node or null if empty left child.
*/
virtual NodeInterface * getLeftChild() const = 0;
/*
* Returns the right child of this node or null if empty right child.
*
* @return the right child of this node or null if empty right child.
*/
virtual NodeInterface * getRightChild() const = 0;
/*
* Returns the height of this node. The height is the number of nodes
* along the longest path from this node to a leaf. While a conventional
* interface only gives information on the functionality of a class and does
* not comment on how a class should be implemented, this function has been
* provided to point you in the right direction for your solution. For an
* example on height, see page 448 of the text book.
*
* @return the height of this tree with this node as the local root.
*/
virtual int getHeight() = 0;
};