-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tree.h
61 lines (46 loc) · 1.44 KB
/
Tree.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
54
55
56
57
58
59
60
61
//Kanellaki Maria Anna - 1115201400060
#ifndef SYSPRO1_TREE_H
#define SYSPRO1_TREE_H
#include <string>
#include "Date.h"
#include "PatientRecord.h"
#include "MaxHeap.h"
using namespace std;
class treeNode { //represents a node of a Tree
Date * date; //key (entry date)
PatientRecord * record; //pointer to a record of a patient
treeNode * left;
treeNode * right;
int height;
public:
treeNode(PatientRecord*);
~treeNode();
treeNode *getLeft() const;
treeNode *getRight() const;
Date *getDate() const;
void setLeft(treeNode *left);
void setRight(treeNode *right);
void setHeight(int height);
int getHeight() const;
PatientRecord *getRecord() const;
};
class Tree { //represents an AVL Tree
treeNode * root;
public:
Tree();
void insertInTree(treeNode*);
treeNode * rotateLeft(treeNode*);
treeNode * rotateRight(treeNode*);
void BalanceTree(treeNode*);
void destroyTree(treeNode*);
int countDiseased(treeNode*);
void countDiseasedDates(treeNode*, Date*, Date*, int*);
void countDiseasedCountry(treeNode*, Date*, Date*, string, int*);
void DiseaseCount(treeNode*, string, int*);
void countAdmitted(treeNode*, int*);
void CopyToHeap(MaxHeap*, treeNode*, string);
void CopyToHeapDates(MaxHeap*, Date*, Date*, treeNode*, string);
~Tree();
treeNode *getRoot() const;
};
#endif