-
Notifications
You must be signed in to change notification settings - Fork 0
/
HashTable.h
71 lines (50 loc) · 1.69 KB
/
HashTable.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
62
63
64
65
66
67
68
69
70
71
//Kanellaki Maria Anna - 1115201400060
#ifndef HASHTABLE_H
#define HASHTABLE_H
#include "PatientRecord.h"
#include "Tree.h"
#include "MaxHeap.h"
class BucketEntry { //represents a disease/country entry of a bucket
string key; //diseaseType or country
BucketEntry * nextEntry;
public:
BucketEntry(PatientRecord *, string);
~BucketEntry();
BucketEntry *getNextEntry() const;
void setNextEntry(BucketEntry *nextEntry);
const string &getKey() const;
};
class Bucket { //represents a bucket of a hash table
int remainingSpace;
Tree * tree;
BucketEntry * first;
Bucket * nextBucket;
public:
Bucket(int);
void InsertInBucket(PatientRecord*, int bucketSize, string, treeNode*);
~Bucket();
BucketEntry *getFirst() const;
Bucket *getNextBucket() const;
Tree *getTree() const;
};
class HashTable { //represents a hash table with size[size] and bucket size [bucketSize] (in bytes).
int size;
int bucketSize;
Bucket ** table;
public:
HashTable(int, int);
void InsertToTable(PatientRecord*, string);
int HashFunction(string);
void PrintCountOfDiseased();
void PrintCountOfDiseasedDates(Date*, Date*);
void PrintCountOfADiseaseDates(string, Date*, Date*);
void PrintCountOfCountryOfADiseaseDates(string, string, Date*, Date*);
void PrintCountOfAdmitted();
void PrintCountOfAdmittedOfADisease(string);
void CopyToHeap(string, MaxHeap*);
void CopyToHeapDates(string, MaxHeap*, Date*, Date*);
~HashTable();
int getSize() const;
int getBucketSize() const;
};
#endif