Question: Please answer the above question in java. Thank you in advance. 2. Queries Create a data structure to support the following operations. (s is a

 Please answer the above question in java. Thank you in advance.2. Queries Create a data structure to support the following operations. (s

Please answer the above question in java. Thank you in advance.

2. Queries Create a data structure to support the following operations. (s is a string consisting of only lowercase English alphabets and a is an integer) Assign(s, a) : Assign string s a score of a (Update the score of s to a if already assigned something else) Delete(s) : Delete s and its score, if it exists MaxScore(): Print the lexicographically smallest string with the maximum score followed by the maximum score, separated by a space. You can assume that whenever MaxScore() is queried, there is at least one string present. O GetScore(s) : Print the score assigned to the string s, if it exists, print 0 otherwise. Input First line of contains N, the number of queries in the test case, followed by N lines describing 1 query in each line. Each query line starts with a single capital letter describing the type of query followed by the arguments. 'A' followed by string s and integer a => Assign(s, a) 'D' followed by string s => Delete(s) 'M' => MaxScore() 'G' followed by s => GetScore(s) Output For every query of tyno Mayson SUSU Hear Each query line starts with a single capital letter describing the type of query followed by the arguments. 'A' followed by strings and integer a => Assign(s, a) 'D' followed by string s => Delete(s) . 'M' => MaxScore() 'G' followed by s => GetScore(s) Output For every query of type MaxScore() and GetScore(), print the output of that query on separate line Constraints 1

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 Databases Questions!