xtralib  0.1.0
A simple header-based drop-in library
Data Structures | Typedefs | Functions
trie.h File Reference

Trie (N-ary tree) structure and functions. More...

#include <xtra/common.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>

Go to the source code of this file.

Data Structures

struct  TrieNode
 

Typedefs

typedef struct TrieNode TrieNode
 

Functions

TrieNodeTrieNodeInit (wchar_t data, int numOfLetters)
 
void TrieNodeFree (TrieNode *node)
 
TrieNodeTrieInsert (TrieNode *root, wchar_t *word)
 Inserts word onto the trie. More...
 
TrieNodeTrieDelete (TrieNode *root, wchar_t *word)
 Deletes words from trie. Will try to delete the word sequence from trie only if it ends up in a leaf node.
 
bool TrieSearch (TrieNode *root, wchar_t *word)
 Searches for a given word.
 
void TriePrint (TrieNode *root)
 
bool TriePrintSearch (TrieNode *root, wchar_t *word)
 

Detailed Description

Trie (N-ary tree) structure and functions.

Author
yung-turabian
Date
4 6 2024

Function Documentation

◆ TrieInsert()

TrieNode* TrieInsert ( TrieNode root,
wchar_t *  word 
)

Inserts word onto the trie.

Warning
Assumes word only has lower case characters.