You are employed by the NSA (National Security Agency) and you have received the following   message that contains the following text:   “George Smiley arrived in Prague on Friday evening at 10:50 PM. ……”          See TTS.txt   A quick analysis of text can be achieved by storing each word  in a hash table.  After storing all words in a hash table you will then be able to print all the words stored in each row of the hash table. Requirements:     Create a hash key value (int Key) and init to a prime value (13)     Create an array of string pointers S_ptr[13]     Each string pointer, S_ptr[i], should allocate on the heap an array of strings (size 35)     Initialize all row elements of hash table with ‘#’     Read the text, one word a time, and compute its hash index value (int Hash(string Word)     The Hash function should take the numerical sum of all the characters in the Word and calculate (Sum%Key )which is then output to the program as an Index.  Recognize that output Index can have only values ranging from(0-12)     Store the word in the hash table row number obtained from the previous step (Index)     Add the input Word into the next free element is the hash table row.  The next free element is decided by finding the next ‘#’ value     After storing all Words in the hash table, print the contents of all rows     Print the total number of words in each row     Sort (bubble sort) the words in each row and print again your results     Provide some conclusions to this analysis   tts.txt -  "George Smiley arrived in Prague on Friday evening at 10:50 PM. As he left the train station he took a taxi to his hotel on Dvozak Boulevard. Next day, he arrived at noon to Café Kafka where he was supposed to meet agent Karla. Smiley sat at the far end of the café next to an empty round table. He placed his briefcase on the floor next to him while drinking his cafe noir. A few minutes past noon, Karla arrived at the cafe with the same looking briefcase and sat on the next table near Smiley. After placing his briefcase next to Smiley, he order a pint of ale and began browsing at the newspaper he took off the rack. A few minutes later, the waiter came to give Smiley his second cup of coffee and tripped creating a bit of a commotion. As this accident unfolded, Karla exchanged briefcases and returned the newspaper back to the rack next to him. Karla then quickly placed a few five Euro coins on the table and picked himself and dashed towards a Svoda taxi standing near the café. To the untrained eye, these events did not seem unusual. After some fifteen minutes later, Smiley paid his bill and went on to watch a magician do his tricks across the square # "

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question



 

You are employed by the NSA (National Security Agency) and you have received the following   message that contains the following text:

 

“George Smiley arrived in Prague on Friday evening at 10:50 PM. ……”

         See TTS.txt

 

A quick analysis of text can be achieved by storing each word  in a hash table.  After storing all words in a hash table you will then be able to print all the words stored in each row of the hash table.

Requirements:

  1.     Create a hash key value (int Key) and init to a prime value (13)
  2.     Create an array of string pointers S_ptr[13]
  3.     Each string pointer, S_ptr[i], should allocate on the heap an array of strings (size 35)
  4.     Initialize all row elements of hash table with ‘#’
  5.     Read the text, one word a time, and compute its hash index value (int Hash(string Word)
  6.     The Hash function should take the numerical sum of all the characters in the Word and calculate (Sum%Key )which is then output to the program as an Index.  Recognize that output Index can have only values ranging from(0-12)
  7.     Store the word in the hash table row number obtained from the previous step (Index)
  8.     Add the input Word into the next free element is the hash table row.  The next free element is decided by finding the next ‘#’ value
  9.     After storing all Words in the hash table, print the contents of all rows
  10.     Print the total number of words in each row
  11.     Sort (bubble sort) the words in each row and print again your results
  12.     Provide some conclusions to this analysis

 

tts.txt - 

"George Smiley arrived in Prague on Friday evening at 10:50 PM.
As he left the train station he took a taxi to his hotel on Dvozak Boulevard.
Next day, he arrived at noon to Café Kafka where he was supposed to meet agent Karla.
Smiley sat at the far end of the café next to an empty round table.
He placed his briefcase on the floor next to him while drinking his cafe noir.
A few minutes past noon, Karla arrived at the cafe with the same looking briefcase and sat on the next table near Smiley.
After placing his briefcase next to Smiley, he order a pint of ale and began browsing at the newspaper he took off the rack.
A few minutes later, the waiter came to give Smiley his second cup of coffee and tripped creating a bit of a commotion.
As this accident unfolded, Karla exchanged briefcases and returned the newspaper back to the rack next to him.
Karla then quickly placed a few five Euro coins on the table and picked himself and dashed towards a Svoda taxi standing near the café.
To the untrained eye, these events did not seem unusual.
After some fifteen minutes later, Smiley paid his bill and went on to watch a magician do his tricks across the square # "

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Fundamentals of Blockchaining
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education