-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashtable.h
44 lines (31 loc) · 920 Bytes
/
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
#ifndef HASHTABLE_H_INCLUDED
#define HASHTABLE_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hash.h"
typedef struct Node Node;
typedef struct Bucket Bucket;
typedef struct Hashtable Hashtable;
struct Node {
char *word;
Node *next_node;
};
struct Bucket {
Node *bucket_head;
};
struct Hashtable {
int size;
Bucket *buckets;
};
Hashtable *create_hashtable(Hashtable *hashtable, int size);
Hashtable *make_double(Hashtable *hashtable);
Hashtable *make_half(Hashtable *hashtable);
void free_hashtable(Hashtable *hashtable);
void clear_hashtable(Hashtable *hashtable);
int add_word(Hashtable *hashtable, char *word);
int remove_word(Hashtable *hashtable, char *word);
int print_bucket(Hashtable *hashtable, int bucket_index, FILE *out_file);
int print_hashtable(Hashtable *hashtable, FILE *out_file);
int find_word(Hashtable *hashtable, char *word, FILE *out_file);
#endif