Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedMust 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 recursion

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

What are my career goals?

Answered: 1 week ago