-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhashP.h
52 lines (35 loc) · 1.15 KB
/
hashP.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
#ifndef hashP_H
#define hashP_H
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "time.h"
typedef struct {
char *word;
char *defn;
} entry;
/* Replace the following with your implementation declarations, but your structure must be typedef'd to hashTable */
typedef struct {
int table_maxsize;
int table_cursize;
int table_delta_capacity;
float table_load_threshold;
entry *entries;
int resize_count;
} hashTable;
/* end of your implementation declarations */
typedef hashTable *Dictionary;
typedef entry* Entry;
Dictionary create(int initial_capacity, int delta_capacity, float load_threshold);
void destroy (Dictionary table);
int exists(Dictionary table, char *index);
int isIndexEmpty(Dictionary table, int index);
void setValueForIndex(Dictionary table, int i, char *index, char *value);
void insertEntry(Dictionary table, char *index, char *value);
void resize(Dictionary table);
int randomNumber(int min, int max);
/* Convert string into hash-index by adding characters. */
unsigned int hash(char *index);
char *getEntry(Dictionary table, char *index);
void deleteEntry(Dictionary table, char *index);
#endif