Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me! Take these 33 letters BCGHLLLMPPPRRRSSSSSTTTYYYYYYYYYYY and unscramble them to form a rather fun and quirky English sentence. The correct phrase consists of

Please help me!

Take these 33 letters BCGHLLLMPPPRRRSSSSSTTTYYYYYYYYYYY and unscramble them to form a rather fun and quirky English sentence. The correct phrase consists of these numbers of letters found in each word:

3 5 5 6 5 2 2 5

--- ----- ----- ------ ----- -- -- -----

Incorrect Example: THE LARGE SUGAR COOKIE EATEN ON MY COUCH The first step to solving this problem would be to find a text file which contains every word in the English language. That can be found for you on Blackboard. The C++ language file also found on Blackboard will take the text file and convert it into both a huge array and a vector of strings. Once you have the text file placed into the correct folder in your Visual Studio project, and once you run the program and no exceptions pop up, you know you have gotten everything off to a good start. Next you can start reducing that word list down. It is easier to use the vector structure to do this but the array is there as well if youd feel more comfortable trying things that way. My way of thinking to reduce the word list and also make it more ordered involves two steps.

1) Eliminate words that contain letters not in your list of allowed letters found above

2) Sort (or create an array of Lists for) the words by their length (number of letters in the word)

You need to reduce the word list so that the computer can solve the problem in a matter of under a minute or two. Without the reduction it could possible take days or more to solve.

Once you have reduce things and sorted them as well, the final step is to brute force all the possible phrases that the combinations of possible words can make. Try every 3 letter word with every 5 letter word with every 5 letter word and so forth and so on. The computer will have to try millions of possible solutions. You know you have a candidate solution when the phrase you are testing matches letter counts with the list at the top of the page. This program you create should find about 100 possible solutions to the problem. Once you have a list of candidates, ask your instructor for the hint that will reduce the solution down to somewhere between 1 and 3 solutions. That final step is up to you the human to deduce. You have done it! You worked with the computer to solve the jumble!

The professor gave us "wordsEn.txt" with all of the words in English and also a source.cpp (bottom), If you could tell me with details what I need to do here because I don't understand anything. That's sad. Can explain to me every step I will appreciate it,, thanks!

source.cpp

#include  #include  #include  #include  // Namespaces using namespace std; // vector wordList; string wordArray[125000]; void LoadDataFromFile( string filename ) { int index = 0; try { ifstream sr( filename ); if( sr.fail() ) { throw filename; } string line; while (sr.eof() == false) { sr >> line; wordList.push_back(line); wordArray[index++] = line; } } catch (string s) { cout << "The file " << s << " could not be read!"; system( "PAUSE" ); exit( 1 ); } } void main() { LoadDataFromFile("wordsEn.txt"); // wordList and wordArray are now both initialized and ready for use int a = 0; } 

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago