Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java public static HashMap buildLastNametoFirstNameMap(String[] fullNames) { /*fullNames is an array of entries all in the format FirstName LastName, a first name and a last

Java

image text in transcribed

public static HashMap buildLastNametoFirstNameMap(String[] fullNames) { /*fullNames is an array of entries all in the format "FirstName LastName", a first name and a last name separated by a space. This function should return a map where the keys are the LastNames from the input array and the corresponding value is the associated FirstName. You may assume each LastName only occurs once in the input array. */ **Test input: an empty array: an array containing "Barry White" and "Bob Marley" public staic HashMap > buildLastNameToFirstName(String[] fulNames) { /*fullNames is an array of entries all in the format "FirstName LastName", a first name and a last name separated by a space. This function should return a map where the keys are the LastNames from the input array and the corresponding value is a list of all the FirstName that appeared with that LastName in the input array. */ } Test input: an empty array: an array containing "Barry White" and "Bob Marley": an array containing Barry White", "Bob Marley" and "Betty White". public static boolean IsPermutationFast(String string1, String string2) { /* This functions should return true if string 1 is a permutation of string2. In this case you should assume that means contains exactly the same characters, same case, including spaces. The strings may contain ascii or Unicode characters. For this question, you should optimize for very long input strings. */ **Test input: 2 empty Strings: "ab" "ba": "abc" "acd": "*rats*"star***": public static boolean IsPermutationLight(String string1, String string2) { /*This functions should return true if string1 is a permutation of string2. In this case you should assume that means contains exactly the same characters, same case, including spaces. The strings may contain ascii or unicode, characters. For this question, you should optimize for space and fairly short input strings. */ **Test input: Same as #8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions