the integers from to we stated earlier that this can be written as ii= ( as gets largethe term will dominate the term and the can be ignored thereforethis solution is ( solution sort and compare another solution to the anagram problem will make use of the fact that even though and are differentthey are anagrams only if they consist of exactly the same characters soif we begin by sorting each string alphabeticallyfrom to zwe will end up with the same string if the original two strings are anagrams the code below shows this solution againin python we can use the built-in sort method on lists by simply converting each string to list at the start def anagram_solution ( , )a_list list( a_list list( a_list sort(a_list sort(pos matches true while pos len( and matchesif a_list [pos=a_list [pos]pos pos elsematches false return matches print(anagram_solution ('abcde','edcba')at first glance you may be tempted to think that this algorithm is ( )since there is one simple iteration to compare the characters after the sorting process howeverthe two calls to the python sort method are not without their own cost as we will see in later sorting is typically either ( or ( log )so the sorting operations dominate the iteration in the endthis algorithm will have the same order of magnitude as that of the sorting process solution brute force brute force technique for solving problem typically tries to exhaust all possibilities for the anagram detection problemwe can simply generate list of all possible strings using the what is algorithm analysis