Question: In this question you will use dictionaries to implement a simple version of a data structure often used for storing large dictionaries of words efficiently,
In this question you will use dictionaries to implement a simple version of a data structure often
used for storing large dictionaries of words efficiently, namely a trie or a prefix tree. The way a
trie works, is that each level stores one letter of a word, and then links to another level. This
combines words with like prefixes, which makes searching and storing the information much
easier:
For the purposes of this assignment, we will consider each level of the structure a dictionary with
keys that are the next letter in the word, and values that are dictionaries of the next level. In order
to know when we have reached a word, we will add a key, 'word', with boolean value True, at
any layer where the path there represents a full word.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
