Sunday, 23 March 2014

Slog 8: BST

     The labs seem to be getting progressively tougher each week and this week was no exception. I feel as though the distinction between a binary search TREE and a BSTNode were not demonstrated well through the tasks in the recent labs. My TA was pretty helpful though, giving hints to point us in the right direction but not spoiling the thought process.
     Something about A2 part B. Using a combination of is_regex and all_regex_permutations is horribly inefficient and perhaps when marks have been given and released I would like to see a more optimal solution and the algorithm behind it. I would be interested in how it works.

Sunday, 16 March 2014

Slog 7: TreeList

     I especially enjoyed exercise 3 this week. I had pulled up images of random trees trying to think up a solution to the task but came up empty for a while. Changing my approach I brought up microsoft paint and started drawing. After taking a few steps back and clearing my mind and remembering the absolutely helpful hint from lecture I had my algorithm going. That was for part A; now part B was a whole other beast. I wrote more versions of sum_to_deepest than I can count on my fingers. I followed the handout and wrote a fully functional method to determine the level of the deepest leaf in a given tree. However I couldn't find a use for that while summing. What I ended up doing was altering that method, and while adding up the levels, also sum the values and compare them at each junction. In the end, returning the sum that followed the level count worked for me.

Sunday, 9 March 2014

Slog 6: Regex

     Another week another assignment, this time with Regular Expressions. Reading through the handout, it was great seeing these trees and nested lists again. I definitely remember how to do them from working on them during the weekly labs. Although I felt comfortable with the abstract data type and general idea, I still fumbled with some syntax errors while inheriting and other small things. This is probably a sign that I need more practice not in theory but actually writing code. The second part of A2 with matching regexes has me worried because I'm still trying to understand the rules and what string representations of regexes are equal. While testing code for A2 part 1, as was with the lab, actually drawing out visualisations of the trees really helped me keep track of the grand scheme of things.

Sunday, 2 March 2014

Slog 5: Test

     Week 7 marks the writing and return of the first term test of this course. During the test I kept second guessing myself for the tracing question but seeing my mark, I guess I ended up with the correct return value. The question using the function sum to delve into deeper levels of recursion was very tricky but I kept looking at the base case that returns a value of 1 and ended up with that as my solution. I have noticed myself that I have a much firmer grasp on recursion but with problems in efficiency. Writing efficient programs seems to take more imagination and cleverness that I can't really work on. Though I enjoy having my TA during the weekly labs criticize my runtime and give hints towards efficient code.