Question: Part 1: public Map getFrequencyMap() This function returns a map that associates each letter to the count of that letter across the entire list of

Part 1:
public Map
This function returns a map that associates each letter to the count of that letter across the entire list of words. That is, after this function is working you should see the following output when running the main method:
list of words = [ally, beta, cool, deal, else, flew, good, hope, ibex] frequency map = {a: 3, b: 2, c: 1, d: 2, e: 7, f: 1, g: 1, h: 1, i: 1, l: 6, o: 5, p: 1, s: 1, t: 1, w: 1, x: 1, y: 1} guess: ? Here, we see that there are, for example, 3 total a characters in the file, which we can see by looking at the list of words. These occurrences of a are in ally, beta, and deal.
Implement the getFrequencyMap method in NaiveLetterFreqGuesser as described above.
Part 2:
public char getGuess(List
This method returns the letter with the greatest frequency that has not yet been guessed. The list of previous guesses is given by the List
For example, if the frequency map is {a=3, b=2, d=2, e=7, l=6, o=5} and guesses is ['e', 'l'], then the next guess should be o.
If there are ties, you should break ties by picking the earliest letter in the alphabet, e.g. if you had to pick between b and d, youd choose b.
NOTE: The easiest way to resolve ties is by using a TreeMap instead of a HashMap, since a TreeMap stores its keys in sorted order.
If the frequency map is empty, then the question mark character (?) should be returned.
/** Returns a map from a given letter to its frequency across all words. * This task is similar to something you did in hwob! */ public Map
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
