Assignment 1#1
Conversation
|
You did a great job here! In part 2, your implementation for checking anagram status with a case sensitivity flag is mostly on the right track, but there are a few issues and improvements that could be made: Inefficiency in Nested Loops: The nested loops inside the comparison() function are inefficient because they compare each character of word_a to each character of word_b, leading to an O(n^2) time complexity. Instead, we can simplify it by sorting both words and comparing the sorted versions or using a frequency counter. Result Array Logic: The result array is used to track matches, but you are resetting its values to 0 unnecessarily. Instead, a better approach would be to keep track of the frequencies of characters in both words. Please go ahead and close this pull request, Thanks! |
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
adding code in assignment-1 for anagram_checker
What did you learn from the changes you have made?
practicing working with strings, function, etc.
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
checking ASCII codes could be another approach.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
there were some redundancy in my code that I tried to handle by adding a new function.
How were these changes tested?
by setting different inputs for the function.
A reference to a related issue in your repository (if applicable)
Checklist