Question: 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:

Need help with the following C code: The structure of a trieNode

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 node

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!