-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdictionary.h
More file actions
executable file
·50 lines (39 loc) · 1.01 KB
/
Copy pathdictionary.h
File metadata and controls
executable file
·50 lines (39 loc) · 1.01 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
/****************************************************************************
* dictionary.h
*
* Computer Science 50
* Problem Set 6
*
* Declares a dictionary's functionality.
***************************************************************************/
#ifndef DICTIONARY_H
#define DICTIONARY_H
#include <stdbool.h>
// maximum length for a word
// (e.g., pneumonoultramicroscopicsilicovolcanoconiosis)
#define LENGTH 45
// maximum length for hash table
#define HASHTABLE_SIZE 65536
// Linked list
typedef struct node{
char word[LENGTH + 1];
struct node* next;
}
node;
/**
* Returns true if word is in dictionary else false.
*/
bool check(const char* word);
/**
* Loads dictionary into memory. Returns true if successful else false.
*/
bool load(const char* dictionary);
/**
* Returns number of words in dictionary if loaded else 0 if not yet loaded.
*/
unsigned int size(void);
/**
* Unloads dictionary from memory. Returns true if successful else false.
*/
bool unload(void);
#endif // DICTIONARY_H