-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdictionary.h
39 lines (31 loc) · 894 Bytes
/
dictionary.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
/*****************************************************************************
**
** dictionary.h
**
** Structure and interface definitions for Dictionary, a string-based
** key-value store
**
** Utilizes a basic hash table implementation to provide constant time O(1)
** lookup and assignment
**
** Author: Sean Butze
**
****************************************************************************/
#include "node.h"
#ifndef DICTIONARY_H
#define DICTIONARY_H
#define DICT_SIZE 501
typedef struct Entry {
char *key;
char *value;
struct Entry *next;
} Entry;
typedef struct Dictionary {
unsigned size;
Entry *table[DICT_SIZE];
} Dictionary;
extern Dictionary* Dictionary_new();
extern char* Dictionary_get(Dictionary *d, char *key);
extern void Dictionary_put(Dictionary *d, char *key, char *value);
extern void Dictionary_delete(Dictionary *s);
#endif