-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
64 lines (48 loc) · 1.58 KB
/
main.cpp
File metadata and controls
64 lines (48 loc) · 1.58 KB
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
/*
CSE 310 Hash Function DIY Contest
Instructor: Yiran "Lawrence" Luo
Your name(s): Eric Everett
Your team alias: Team Eric Everett
*/
#include <iostream>
#include <iomanip>
#include <string>
#include "hash.h"
using namespace std;
int main() {
int k = 0;
int n = 0;
string texts[500];
// WARNING: Start of the tokenizer that loads the input from std::cin, DO NOT change this part!
cin >> k;
string line;
getline(cin, line);
while (getline(cin, line)) {
texts[n] = line;
n++;
}
// WARNING: End of the tokenizer, DO NOT change this part!
// By this point, k is the # of slots, and n is the # of tokens to fit in
// texts[] stores the input sequence of tokens/keys to be inserted into your hash table
// The template is able to be compiled by running
// make
// ./encoder < inputs/sample_input.txt
// which puts out the placeholders only.
// Your time to shine starts now
// Create a new hash table with k slots
HashTable hashtable(k);
// Insert the texts into the hash table
for (int i = 0; i < n; i++) {
hashtable.insert(texts[i]);
}
cout << "==== Printing the contents of the first 5 slots ====" << endl;
// Print the contents of the first 5 slots
hashtable.print_first_five_slots();
cout << "==== Printing the slot lengths ====" << endl;
// Print the lengths of the slots
hashtable.print_slot_lengths();
cout << "==== Printing the standard variance =====" << endl;
// Print the standard variance
hashtable.print_standard_deviation();
return 0;
}