Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Must be in C++ and use of recursion Part 2: ScrabbleSolver In Scrabble you have a set of tiles and you can form words with
Must be in C++ and use of recursion
Part 2: ScrabbleSolver In Scrabble you have a set of tiles and you can form words with those tiles that can be of any length. Scrabblesolver will find all the words that can be created with a set of letters, not just the permutations of those letters. That is, for the Scrabble tiles "TCA", you would get the words "CAT", "ACT", "AT" and "TA". This is very similar to Unscramble . Instead of only checking whether a word is in the words map when the prefix is empty, you can always check whether a prefix is in the words map and cout that prefix immediately. Hint: Make a second recursive helper function which can be called by ScrabbleSolver and takes any necessary arguments to start the recursion. Part 3: ScrabbleSolverNoDupes You may have noticed that scrabblesolver ends up printing duplicate words if you have duplicate letters. For example, for the letters "CLLA", Scrabblesolver prints out some words twice, like "CAL", "CALL", "ALL". In fact, any letter with an "L" is printed twice. In this part you should implement a scrabble solver that ensures no duplicate words are printed by keeping track of the words which are already found. You can do this by using a std::map<:string bool>& parameter, used_words in your recursive helper function. Each time you find a new valid word, put it in used_words so that you don't use it again. Note: used_words is a reference type because we want to use exactly one version of the map no matter which recursive function we are in. If we passed used_words by value then any modifications would not persist! Hint: Make a third recursive helper function which can be called by ScrabblesolverNoDupes and takes any necessary arguments to start the recursionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started