Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with the following C code: The structure of a trieNode is as follows: struct trieNode( struct trieNode* letters[26]; int EOS; I; Your goal
Need help with the following C code:
The structure of a trieNode is as follows: struct trieNode( struct trieNode* letters[26]; int EOS; I; Your goal is to write a function: void addWord (struct trieNode* root, char *word); which accepts a single trieNode pointer, and a string named "word" (which is guaranteed to consist of only uppercase letters between A and Z, inclusive). Your function should add the word to the trie. You may assume the word is not already present in the trie. To do this, begin with the first letter of the word, check that pointer in the root node, and if it is non-NULL, follow it to another node; otherwise, create a new (properly-initialized) trieNode, point to it, and continue. After following the pointer for the last letter, set EOS-1 in that nodeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started