Given: You are given a Python Class template, and a list of words in the file 'american-english-no-accents.txt'. In the template

Task: Write a recursive trie data structure. Each node should store either a character or a word. Then, implement the autocomplete method. This method should recursively explore the trie and return a list of all words in the trie that match that prefix. The list must be in alphabetical order.

Example: Given the words 'dad', 'daddy', 'daddio', 'danny', 'mum', and 'mummy', the trie should look like this: see image.

When the prefix 'da' is autocompleted, the list returned should be: ['dad', 'daddio', 'daddy', 'danny']. When the prefix '' is given, every word in the trie should be returned, in alphabetical order. When the prefix 'uncl' is given, an empty list should be returned.

Notes: Ensure that duplicate words do not get added to the trie twice. Both lower and upper case letters will be used. Consider them as seperate characters, upper case letters coming before lower case. The file 'american-english-no-accents.txt' is used by the tester but you can write your own test dictionary and tester program.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.