subject
Engineering, 26.03.2020 22:44 oscar4hunnid

In this constructor you should initialize a new anagram solver over the given dictionary of words. You may assume that

the words in the set are in alphabetical order. Do not modify the set passed to your constructor.

You should throw an IllegalArgumentException if the set passed is null.

public Set getWords(String phrase)

In this method you should return a set containing all words from the dictionary that can be made using some or all of the

letters in the given phrase, in alphabetical order. For example, if your anagram solver is using the dictionary

corresponding to dict1.txt and you are passed the phrase "Barbara Bush", you should return a set containing the

elements [abash, aura, bar, barb, brush, bus, hub, rub, shrub, sub].

You should throw an IllegalArgumentException if the string is null.

public void print(String phrase)

In this method you should use recursive backtracking to find and print all anagrams that can be formed using all of the

letters of the given phrase, in the same order and format as in the example log on the previous page. For example, if your

anagram solver is using the dictionary corresponding to dict1.txt and you are passed the phrase "hairbrush", your

method should produce the following output:

[bar, huh, sir]

[bar, sir, huh]

[briar, hush]

[huh, bar, sir]

[huh, sir, bar]

[hush, briar]

[sir, bar, huh]

[sir, huh, bar]

You should throw an IllegalArgumentException if the string is null. An empty string generates no output.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
The flow rate of air through a through a pipe is 0.02 m5/s. a pitot static tube is placed in the flow. the radius of the pitot static tube is 1 mm. assuming the flow to be steady and the air to be at 300k, calculate the difference in total and static pressure if the diameter of the pipe is: (a) d 0.1 m d 0.05 m (c) d 0.01 m
Answers: 2
question
Engineering, 04.07.2019 18:20
Have a greater impact on maintenance productivity than any other support group. (clo5) a)-the top management b)-inventory and purchasing c)-sub-contracting d)-cmms
Answers: 2
question
Engineering, 04.07.2019 18:20
Inspection for bearing condition will include: (clo4) a)-color b)-smell c)-size d)-none of the above
Answers: 1
question
Engineering, 04.07.2019 19:10
What is a monomer? how do they form a ploymer from the view point of chemical bonding?
Answers: 1
You know the right answer?
In this constructor you should initialize a new anagram solver over the given dictionary of words. Y...
Questions
question
Mathematics, 30.01.2020 02:55
question
Chemistry, 30.01.2020 02:55
Questions on the website: 13722360