This is a JSFiddle assignment and must be completed at jsfiddle.net and include
ID: 3576620 • Letter: T
Question
This is a JSFiddle assignment and must be completed at jsfiddle.net and include both the HTML and Java sections
Implement a TRIE that has both the functions AddToTRIE and CheckSpelling.
Once you have created the TRIE add the words (hard code) I, in, into, inlet, inn, inner, innate, ink. These are good words to use to test your TRIE
Create an interface that has one text box for entry and 2 buttons - Add To Dictionary and Spell Check. They should ad the word to the TRIE (feedback - word added) and check the word against the TRIE and return in the word was in or not in the dictionary.
Explanation / Answer
class TrieNode { char c; HashMap children = new HashMap(); boolean isLeaf; public TrieNode() {} public TrieNode(char c){ this.c = c; } } public class Trie { private TrieNode root; public Trie() { root = new TrieNode(); } // Inserts a word into the trie. public void insert(String word) { HashMap children = root.children; for(int i=0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.