Question: Question 2: Implement an Anagram Checker (algs.h) Your function, given two strings, should return true if two strings could be anagrams of one another or
-
Question 2: Implement an Anagram Checker (algs.h)
-
Your function, given two strings, should return true if two strings could be anagrams of one another or false otherwise
-
Two strings are anagrams of one another if one can rearrange the characters of one string to equal the other.
-
You can assume all strings are composed of characters A..Z
-
Obviously, BBB is not an anagram of CAB...
-
Your answer must run in O(m+n+k) time, where m and n are lengths of the two strings and k is the number of characters in the character set (26, here). This means:
-
You cannot sort the strings with a typical comparison based sort
-
You cannot read the strings more than a fixed number of times per character (you can do this by visiting each string character exactly once)
-
A helper function is a good idea here (to convert characters to something)
-
-
Using C++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
