-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (31 loc) · 764 Bytes
/
main.cpp
File metadata and controls
41 lines (31 loc) · 764 Bytes
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
#include <ctime>
#include <cstdlib>
#include <iostream>
#include "HashSet.h"
using namespace std;
void initHashSet(HashSet &hs, int* values){
for (int i = 0; i < 20; ++i){
hs.add(values[i]);
}
}
int main(){
srand(time(0));
auto generateValues = [](int count, int* out){
for (int i = 0; i < count; ++i) out[i] = rand() % 100 + 1;
};
int values[20];
generateValues(20, values);
cout << "SIMPLE" << endl;
HashSet hss(2, SIMPLE);
initHashSet(hss, values);
hss.printHashSet();
cout << "LINEAR PROBING" << endl;
HashSet hslp(2, LINEAR_PROBING);
initHashSet(hslp, values);
hslp.printHashSet();
cout << "ROBIN HOOD" << endl;
HashSet hsrh(2, ROBIN_HOOD);
initHashSet(hsrh, values);
hsrh.printHashSet();
return 0;
}