If you finally arrive at a node you check whether it


Design and create a spelling checker that has at least the following methods:

• void add(String word)-Adds a word to a spelling checker's collection of correctly spelled words

• boolean check(String word)-Returns true if the given word is spelled correctly

Store the collection of correctly spelled words in a 26-ary tree. Each node in this tree has a child corresponding to a letter in the alphabet. Each node also indicates whether the word represented by the path between the root and the node is spelled correctly. For example, the tree shown in Figure 23-26 depicts this indication as a filled-in node. This tree stores the words "boa," "boar," "boat," "board," "hi," "hip," "hit," "hop," "hot," "trek," and "tram." To check whether a given word is spelled correctly, you begin at the tree's root and follow the reference associated with the first letter in the word. If the reference is null, the word is not in the tree. Otherwise, you follow the reference associated with the second letter in the word, and so on. If you finally arrive at a node, you check whether it indicates a correctly spelled word. For example, the tree in Figure 23-26 indicates that "t," "tr," and "tre" are spelling mistakes, but "trek" is spelled correctly.

1658_e8aac2df-ede7-4726-be1d-ea0238975c7a.png

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: If you finally arrive at a node you check whether it
Reference No:- TGS02196194

Expected delivery within 24 Hours