You are given a Map that contains an email mailing list address book. In the Map, the keys are aliases, and the corresponding values are lists consisting of email addresses and other aliases. An email...


You are given a Map that contains an email mailing list address book. In the Map, the keys are aliases, and the corresponding values are lists consisting of email addresses and other aliases. An email address is guaranteed to contain the @ sign and an alias is guaranteed to not contain the @ sign. An example of a Map is


Write routine expandAlias that takes a Map and an alias and returns the Set of all email address that the alias expands to. For example, expanding all yields a Set containing six email addresses. Note that if the alias parameter is an email address, expandAlias returns a Set of size one. If the alias parameter is not an email address, but is an invalid alias (i.e. not in the map), you can return a Set of size zero. In writing your code, first assume that there are no cycles in which an alias eventually includes itself. Eventually handle the case in which an alias appears more than once in an expansion (by keeping track of aliases that have already been expanded).




Dec 13, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here