Friday 17 January 2014

Initial Post (Week 2)

  This week we wrapped up lectures on queues and stacks. These data types are quite imperative in computer science discipline and their usage can be found on the simplest of programs, such as executing any recursive function. We implemented these types in Python using an easy but inefficient method that utilizes lists.

  We also tried to write a method that found the size of a stack by only using the stack's methods. Many people found unique solutions which left us in wonder. This showed us the ubiquitous ways a programmer may approach a problem yet each solutions efficiency would still be in question.

  In our first lab we tried to program a word counter that can also show us some statistics about our usage of certain words. Our TA, in his example, implemented it by using dictionaries to hold words and their frequencies.  However I wanted to try a different approach so I used a duple list to store words and their frequencies. This approach had some problems that weren't encountered in the dictionary approach. First of all, as duples are immutable, when you encounter the same word again in the same content you just can't update the frequency in the duple. So I sorted my initial list of words before parsing to find frequency for each word by easily iterating over the list until I came up on a new word. Although, I'm not sure about the efficiency of my algorithm it is nice to come up with different approaches every now and then.

Til next time, take care!