13 typedef struct _Trie {
19 int32_t (*insert) (
struct _Trie*,
char*);
23 int32_t (*bulk_insert) (
struct _Trie*,
char**, int);
27 int32_t (*has_exact) (
struct _Trie*,
char*);
31 int32_t (*has_prefix_as) (
struct _Trie*,
char*);
35 int32_t (*get_prefix_as) (
struct _Trie*,
char*,
char***,
int*);
39 int32_t (*
delete) (
struct _Trie*,
char*);
43 int32_t (*size) (
struct _Trie*);
int32_t TrieInsert(Trie *self, char *str)
Insert a string into the trie.
TrieData * pData
The container private information.
int32_t TrieGetPrefixAs(Trie *self, char *str, char ***paStr, int *piNum)
Retrieve the strings from the trie matching the designated prefix.
int32_t TrieSize(Trie *self)
Return the number of strings stored in the trie.
struct TrieData_ TrieData
TrieData is the data type for the container private information.
void TrieDeinit(Trie **ppObj)
The destructor for Trie.
int32_t TrieHasPrefixAs(Trie *self, char *str)
Check if the trie contains the strings matching the designated prefix.
int32_t TrieBulkInsert(Trie *self, char **aStr, int iNum)
Insert an array of strings into the trie.
The implementation for trie.
int32_t TrieDelete(Trie *self, char *str)
Delete a string from the trie.
int32_t TrieHasExact(Trie *self, char *str)
Check if the trie contains the designated string.
int32_t TrieInit(Trie **ppObj)
The constructor for Trie.