-
Notifications
You must be signed in to change notification settings - Fork 0
/
BSTreeNode.hpp
46 lines (35 loc) · 959 Bytes
/
BSTreeNode.hpp
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
#ifndef BSTreeNode_hpp
#define BSTreeNode_hpp
#include <stdio.h>
template <typename T>
class BSTreeNode
{
private:
BSTreeNode<T> *right; //pointer to right child
BSTreeNode<T> *left; //pointer to left child
BSTreeNode<T> *parent; //pointer to parent
T data; //value inside node
bool balanceEnabled = false;
int bf = 0; //balance factor
public:
BSTreeNode(const T& value);
BSTreeNode(const BSTreeNode &rhs);
const BSTreeNode<T> & operator=(const BSTreeNode &rhs);
~BSTreeNode();
void Insert(const T& value);
void InsertAVL(const T& value);
bool Search(const T& value);
//BSTreeNode<T> * Search(const T& value);
size_t Size();
void Clear();
void PrintInOrder();
void PrintPreOrder();
void PrintPostOrder();
void PrintDOT();
// get/set for balancedEnabled here
// void leftRotate(BSTreeNode* theNode);
// void rightRotate(BSTreeNode* x);
// void reBalance(BSTreeNode* theNode);
double computeACE();
};
#endif /* BSTreeNode_hpp */