Defines | |
#define | TRIE_NULL ((void *) 0) |
A null TrieValue. | |
Typedefs | |
typedef struct _Trie | Trie |
A trie structure. | |
typedef void * | TrieValue |
Value stored in a Trie. | |
Functions | |
Trie * | trie_new (void) |
Create a new trie. | |
void | trie_free (Trie *trie) |
Destroy a trie. | |
int | trie_insert (Trie *trie, char *key, TrieValue value) |
Insert a new key-value pair into a trie. | |
TrieValue | trie_lookup (Trie *trie, char *key) |
Look up a value from its key in a trie. | |
int | trie_remove (Trie *trie, char *key) |
Remove an entry from a trie. | |
int | trie_num_entries (Trie *trie) |
Find the number of entries in a trie. |
A trie is a data structure which provides fast mappings from strings to values.
To create a new trie, use trie_new. To destroy a trie, use trie_free.
To insert a value into a trie, use trie_insert. To remove a value from a trie, use trie_remove.
To look up a value from its key, use trie_lookup.
To find the number of entries in a trie, use trie_num_entries.
void trie_free | ( | Trie * | trie | ) |
Destroy a trie.
trie | The trie to destroy. |
Insert a new key-value pair into a trie.
trie | The trie. | |
key | The key to access the new value. | |
value | The value. |
Look up a value from its key in a trie.
trie | The trie. | |
key | The key. |
Trie* trie_new | ( | void | ) |
Create a new trie.
int trie_num_entries | ( | Trie * | trie | ) |
Find the number of entries in a trie.
trie | The trie. |
int trie_remove | ( | Trie * | trie, | |
char * | key | |||
) |
Remove an entry from a trie.
trie | The trie. | |
key | The key of the entry to remove. |