Sunday, March 16, 2014
Week 9 Slog
This week we have studied the Anagrams, which means letters of one word can be
rearranged to be become another word. For example, horse and shore are anagrams. If a word is not in the English wordlist, it is not an anagram, such as seohr is not an anagram of horse. In this week, we have tried to find a easy way to find all Anagrams by using a short amount of time. We used the Timing runtime to get a sense of an algorithm's efficiency. Firstly, we should know what are the permutations of one word. For instance, the word 'dog', the permutations are: dog, dgo, odg, ogd, gdo, god. So 3 letter, 6 permutations, 4 letter, 4*3*2*1 = 24 permutations , 5 letter, 5! permutations ... 120 permutations. As you can see that is a huge workload. We have also proved this formula. The proof is a very complicated and long process but I found it very interesting.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment