Unique Values This function will receive a single map parameter known as a_map. a_map will contain a single letter as a string and numbers as values. This function is supposed to search a_map to find all values that appear only once in a_map. The function will create another map named to_ret. For all values that appear once in a_map the function will add the value as a key in to_ret and set the value of the key to the key of the value in a_map (swap the key-value pairs, since a_map contains letters to numbers, to_ret will contain Numbers to Letters). Finally, the function should return to_ret. Signature: public static HashMap uniqueValues(HashMap a_map) Example: INPUT: {0=M, 2=M, 3=M, 5=M, 6=n, 7=M, 9=M} OUTPUT: {n=6} INPUT: {0=A, 1=c, 2=c, 4=c, 5=a, 8=Q, 9=c} OUTPUT: {A=0, a=5, Q=8}

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter9: Working With Text Functions And Creating Custom Formats
Section: Chapter Questions
Problem 1.7CP
icon
Related questions
Question

Unique Values

This function will receive a single map parameter known as a_map. a_map will contain a single letter as a string and numbers as values. This function is supposed to search a_map to find all values that appear only once in a_map. The function will create another map named to_ret. For all values that appear once in a_map the function will add the value as a key in to_ret and set the value of the key to the key of the value in a_map (swap the key-value pairs, since a_map contains letters to numbers, to_ret will contain Numbers to Letters). Finally, the function should return to_ret.

Signature:

public static HashMap<String, Integer> uniqueValues(HashMap<Integer, String> a_map)

Example:

INPUT: {0=M, 2=M, 3=M, 5=M, 6=n, 7=M, 9=M}
OUTPUT: {n=6}

INPUT: {0=A, 1=c, 2=c, 4=c, 5=a, 8=Q, 9=c}
OUTPUT: {A=0, a=5, Q=8}

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Operations of Linked List
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
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT