Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Given an arbitrary ransom note, consisting of 15 - 20 words and several magazines, write a function that will return a true, if the
1. Given an arbitrary ransom note, consisting of 15 - 20 words and several magazines, write a function that will return a true, if the ransom note can be constructed from the words in the magazines, otherwise it will return a false. Each word in the magazines can only be used once in your ransom note. The algorithm should work efficiently, such as, utilizing hash tables for storing and looking up strings. An example hash function maybe the sum of the ascii values of all the characters in the string, modulus an appropriate positive inte- ger. For testing the code, utilize the ransom note and the magazines provided on the Black board in files RansomNote.dat, Magazinel.dat, Magazine2.dat, Magazine3.dat, Magazine4.dat, Magazine5.datand Magazine6.dat. In this problem, you will utilize the built in string class, its constructors, some of its methods and operators. For more on the string class, please refer to Prata, Chapter 16 and the link http: //www.cplusplus.com/reference/string/string/ (6 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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