-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdictionary.h
More file actions
39 lines (24 loc) · 862 Bytes
/
dictionary.h
File metadata and controls
39 lines (24 loc) · 862 Bytes
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
/*
* In order to quickly find the corresponding list node for a specific char
* we need an array structure, with size 256 as in ascii table
* the array will have 256 list nodes
* call it dictionary, use listnode->n->c to locate
*/
#ifndef _DICTIONARY_H_
#define _DICTIONARY_H_
#include <stdio.h>
#include <stdlib.h>
#include "tree.h"
#include "list.h"
// an array of listnodes, size usually = 256
typedef ListNode* Dictionary;
// create and destroy, size usually = 256
Dictionary DictionaryCreate(int size);
Dictionary DictionaryDestroy(Dictionary, int size);
// search, return array[c] or NULL
ListNode DictionarySearch(Dictionary, int c);
// insert new listnode into position based on listnode->trn->c
void DictionaryInsert(Dictionary, ListNode);
// debug use: print the dictionary
void DictionaryShow(Dictionary, int size);
#endif