Every year, the government publishes a list of the top 10,000 baby names and their frequency (the number of babies with that name). The only issue is that some names have different spellings. For example, "John" and ".Jon" are the same name. However, they would be mentioned individually in the list. Write a method to produce a new list with the real frequency of each name given two lists, one of names/frequencies and the other of pairings of equivalent names. It is important to note that if John and Jon are synonyms, and Jon and Johnny are synonyms, then John and Johnny are synonyms. (It has both transitive and symmetric properties.) Any name on the final list can be used as the "actual" name. EXAMPLE Input: Names: John (15), Jon (12), Chris (13), Kris (4), Christopher (19) Synonyms: (Jon, John), (John, Johnny), (Chris, Kris), (Chris, Christopher) Output: John (27), Kris (36)

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

Every year, the government publishes a list of the top 10,000 baby names and their frequency (the number of babies with that name). The only issue is that some names have different spellings. For example, "John" and ".Jon" are the same name.

However, they would be mentioned individually in the list. Write a method to produce a new list with the real frequency of each name given two lists, one of names/frequencies and the other of pairings of equivalent names. It is important to note that if John and Jon are synonyms, and Jon and Johnny are synonyms, then John and Johnny are synonyms. (It has both transitive and symmetric properties.) Any name on the final list can be used as the "actual" name.
EXAMPLE
Input:
Names: John (15), Jon (12), Chris (13), Kris (4), Christopher (19)
Synonyms: (Jon, John), (John, Johnny), (Chris, Kris), (Chris, Christopher)
Output: John (27), Kris (36)

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Math class and its different methods
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