Question: You have been asked to construct a program that determines if two words are anagrams. Two words are anagrams if they contain the same
You have been asked to construct a program that determines if two words are anagrams. Two words are anagrams if they contain the same letters in the same frequency. For example, "top" and "pot" are anagrams. Use an insertion sort to solve these two problems: To check if two words are anagrams, simply sort the characters in each word. If the sorted versions are the same, the words are anagrams of each other. 1 Requirements: Create a class Ang in package assign01. Add the following two methods. public static String sort(String) This method returns the sorted version of the input string. The sorting must be performed using an insertion sort. public static boolean areAnagrams(String, String) This method returns true if the two input strings are anagrams of each other, otherwise returns false. This method must call your sort(String) method. NOTES: As demonstrated by the example above, words with the same letters in the same frequency, but different cases are still anagrams. E.g., "Top" and "top" are anagrams.
Step by Step Solution
3.44 Rating (163 Votes )
There are 3 Steps involved in it
J ava Program for Anagram import javautilArrays creating a class Ang public class Ang public static ... View full answer
Get step-by-step solutions from verified subject matter experts
