#include <cstdio>
#include <cstring>
#include <cassert>
#include "HashFunctions.cpp"
template <typename T>
class Node {
public:
T val;
Node* next_;
Node(T val): val(val), next_(nullptr) {};
};
template <typename T>
class List {
public:
Node<T>* head_;
unsigned long size_;
List(): head_(nullptr), size_(0){}
void push_front(Node<T>* new_node){
assert(new_node != nullptr);
new_node->next_ = this->head_;
this->head_ = new_node;
++this->size_;
}
};
template <typename T1, typename T2>
struct Pair_t {
T1 first;
T2 second;
};
template <typename key_t, typename val_t, unsigned long (*hash)(key_t), int (*cmp)(key_t, key_t), unsigned long max_size>
class HashTable {
public:
List<Pair_t<key_t, val_t>>* table;
HashTable(){
table = new List<Pair_t<key_t, val_t>>[max_size]();
}
void insert(key_t key, val_t val){
unsigned long h = hash(key);
Node<Pair_t<key_t, val_t>>* new_node = new Node<Pair_t<key_t, val_t>>(Pair_t<key_t, val_t>{key, val});
table[h].push_front(new_node);
}
Node<Pair_t<key_t, val_t>>* find(key_t key){
unsigned long h = hash(key);
Node<Pair_t<key_t, val_t>>* cur = table[h].head_;
while (cur != nullptr){
if (cmp(key, cur->val.first) == 0){
return cur;
}
cur = cur->next_;
}
}
};
int main(void){
HashTable<const char*, int, one_at_a_time, strcmp, 100> t{};
FILE* input = fopen("./words_alpha.txt", "r");
char word[100] = "";
fscanf(input, "%s", word);
t.insert(word, 228);
fclose(input);
}