Thursday, 20 March 2014

Week 9

This week we learned about complexity. We were introduced to Big-Oh notation which help us understand the efficiency of our code based on many how steps the code takes. The lecture started with working on creating a program that finds all of the words that are anagrams of a given word. First thought was to use the permutation approach, which was not a very good solution since the amount of work we estimated was a lot depending on the length of the word and checking if all of the generated permutations are real words or not.

The second method to solving the anagram code was something Dan called "Signature approach". Basically, you take the argument word and re-arrange its letters in alphabetical order and then that becomes the argument's "signature". We can then generate a list of anagrams of the argument by checking if their signature is the same as our initial one and this proved to be a better solution.

I am not very comfortable with determining time effficiency yet, but I will be practicing it this weekend so I should be ready for next week. I think next week's lab will be based on determining time efficiency of given code and finding most efficient solutions for given functions.

No comments:

Post a Comment