-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdictionary.h
More file actions
62 lines (47 loc) · 1.13 KB
/
dictionary.h
File metadata and controls
62 lines (47 loc) · 1.13 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
50
51
52
53
54
55
56
57
58
59
60
61
62
/****************************************************************************
* dictionary.h
*
* Laufenshoen
*
* 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
struct trie myTrie;
//freeCount++;
//mallocCount;
typedef struct node
{
bool leaf;
struct node* characters[27];
} node;
typedef struct trie
{
int count;
node* root;
} trie;
/**
* 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);
/**
* Creates another node with an array of 27 indexes and a leaf inidicator.
*/
node* getNode(void);
#endif // DICTIONARY_H