Question: 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

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}


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!