-
Notifications
You must be signed in to change notification settings - Fork 0
/
TreeNode.h
51 lines (34 loc) · 1.08 KB
/
TreeNode.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
#ifndef _TREENODE_H
#define _TREENODE_H
#include "DBentry.h"
class TreeNode {
private:
DBentry* entryPtr;
TreeNode* left;
TreeNode* right;
public:
// A useful constructor
TreeNode(DBentry* _entryPtr);
// the destructor
~TreeNode();
// sets the left child of the TreeNode.
void setLeft(TreeNode* newLeft);
// sets the right child of the TreeNode
void setRight(TreeNode* newRight);
// gets the left child of the TreeNode.
TreeNode* getLeft() const;
// gets the right child of the TreeNode
TreeNode* getRight() const;
// returns a pointer to the DBentry the TreeNode contains.
DBentry* getEntry() const;
bool insert(DBentry* newEntry);
DBentry* find(string name, int& probes);
//parent and dir are to replace one parent pointer (right or left)
bool remove(string name, TreeNode* parent, int dir);
//Sets the parent to the maximum value of the calling tree
void max(TreeNode* parent);
//Counts active nodes in tree
int countActive();
void print();
};
#endif