Friday 28 March 2014

Week 11

This week we had the second term test so we didn't have a lot of time in class. During the class we focused mainly on what happens when the stack runs out of room. The example we used in class was with recursion and how when the function keeps running the same function over and over again, you run out of room. I was a little apprehensive at first because I had no idea how you would be able to fix this. I found it very interesting when the professor used a dictionary to give values that were already calculated. I was a little confused when he showed us the implementation with out using recursion but once I traced through some example it started to make sense.

The test was not overly hard except for the last question with the big-Oh stuff. I had a general idea of what kind of big-Oh it was but I couldn't really explain myself so I left that question blank. The other function were not overly hard for me but I did run out if time. I can be slow when implementing functions, especially when I'm under pressure but in the end I think I did okay.

For this weeks slog, we have to talk about sorting and efficiency. I never knew there were so many ways to sort list. What was most interesting for me was how much more efficient Python's built-in sort was compared to the others. Another thing that surprised me was how different function worked better depending on whether the list was close to sorted or not. I'm pretty sure I have a good grasp on efficiency in general but I can't really determine which function would be more efficient just by looking at it.

Friday 21 March 2014

Week #10

The first class of this week was mostly spent talking about Assignment 2 Part 2. At the time I had already finished is_regex and build_regex_tree and was mostly done regex_match. The one that was mainly giving me problems was all_regex_permutations. At first I didn't understand what exactly was being asked but once the professor explained it in class I understood exactly what was needed. It really helped that we could use the code for making permutations from week 4. After that it was just a matter of checking which of the permutations are regular expressions and which are not. This was very easy since I had already implemented is_regex.

It was also helpful when the professor explained how to check regex_match for StarTrees. I had a code that didn't use recursion but it was very messy and complicated but by using recursion I was able to shorten the code a lot.

The rest of the class was spent talking about the efficiency of different sorting algorithms. I found it especially interesting to see how much quick sort depends of whether the list is close to sorted or not.

The tutorial this week was actually very interesting where we tried to combine binary trees with linked lists. Me and my partner were able to finish the lab with time to spare but we did hit a snag. we were able to fix it in the end but it was interesting to see.

Wednesday 19 March 2014

Week #9

This week's blog is a little late. I usually type the out in word and then transfer it to the text box but I completely forgot to until today.

On Monday of this week, most of the class was spent talking about Binary search trees. After the tutorial, I'm feeling pretty confident about BST's. it really helped to do some implementation of my home. It especially hit home how important recursion is. The bonus exercise was almost impossible to figure out but my partner was able to figure out an algorithm.

After that we started talking about runtime and performance and how different algorithms have different level of efficiency based on how much time it takes to run a function compared to the size of the input. Interestingly enough we are talking about the exact same thing in CSC165. We pretty much just started on big-oh so I'm not terrible comfortable with it yet but I was able to understand the gist of what the professor was saying.

We also talked about Exercise 3 and a little bit about Assignment 2 part 2. I already looked over part 2 of assignment 2 and even though it looked daunting I have a pretty good idea about how to go about it. After the professor explained the relationship between the inorder list and the preorder list, it was easy to code part A of Exercise 3. Part B was a little trickier but the hint on making a helper function that returns both the depth and that sum at that depth really helped.

Friday 7 March 2014


Week #8

This week was spent talking about Linked Lists and the different ways you can implement them. Linked List rely heavily on recursion but since I think I have a pretty good grasp on recursion, I’m not too worried. At first, I didn’t understand Linked Lists and I didn’t understand why we needed them. After looking at the implementation for the different functions in Linked List I started to get the hang of it. The lab this week was also extremely helpful in showing how to implement your own functions for Linked List. My partner and I finished the entire lab and we started on the bonus work. We weren’t able to finish but I feel a lot better about Linked Lists than I did before.

One thing that I also found hard to understand is the Linked Lists wrapper class that we created. I understand that is meant to encase the linked lists but I don’t exactly understand why we need it.

One thing I that I didn’t understand before was the difference between str and repr. When the instructed explained that repr is a string representation where what the function return can be cut and pasted into the shell and will produce the same object. This cleared everything up greatly and also was very helpful toward Assignment 2 Part I.  

Tuesday 4 March 2014


Week #7

At first I thought recursion was a little intimidating and I had a lot of trouble tracing it. After I started using it and implementing it myself it became a lot easier. Now I realize that recursion is very useful and if you use it correctly, it is actually quite easy to understand. It was especially useful when I was doing assignment one. Apparently there was a way you could code it without having to use recursion but I don’t think I would have ever figured it out by myself if I tried. When I was coding, I didn’t have a problem with the recursion itself, my problem mostly lay in other areas.

This week we started learning about linked list and we also had our test. From what we learned so far, linked lists don’t seem too hard but I don’t know if that will change in the future. I am pretty confident that I did well on the test. Nothing seemed overly impossible but I did have trouble remember the details about classes such as Stack that we used in class. Everything else was pretty easy and I feel confident that I’ll do well.

Friday 14 February 2014


Week #6 Blog

This week I spent most of my time trying to figure out my solution for the towers of Anne Hoy with four stools. I finally figured it out when I used helper functions that I defined in the function. I tried it with different numbers of cheeses and I was able to get the least amount of moves for them. After that, I did step 6 which was really easy once step 5 was finished. I even had plenty of time to work on the bonus problem. At first I didn’t understand what was different the then __eq__ method but once I looked at the docstring, I think I was able to code the function properly. Overall, I’m very confident with my result.

During the lectures we started talking about trees. I understood everything pretty well but I was a little unsure when we started trying to code some of the functions such as in_order. After a while I was able to get it. During the second class I was able to do most of the coding myself although sometimes I used the base case for the if condition when the professor used the general case but overall, I think I understand trees pretty well.

The lab was pretty easy as well and my partner and I were able to finish early. I was able to code everything easily enough but I don’t exactly understand how the functions any, zip and filter work. I want to see if I can use them on my own in order to see if I can understand what they are doing.

Friday 7 February 2014


Week #5 Blog

 This week we worked on the recursion function for the towers of Hanoi with 3 stools. We also looked at names and which name gets priority at different parts of the function.

I was a little uneasy about recursion at first but after I started tracing different recursions I started to get the hang of it. Once I worked out the kinks I figured out how to implement recursion myself. Over the weekend I was able to fix the problem I was having with GUIController and I was able get it to work. After that I started to tackle the four stools problem. I didn’t understand what I actually had to do at first but after reading it for the billionth time I was able to grasp what I actually had to do. It helped a lot when we did the recursion for 3 stool in class. I have gotten very close to solving it but i haven’t finished it yet.

I am very happy now that I’ve got a better grip on recursion. Especially during the lab when my partner and I were able to finish all of the exercises and even some of the extra ones.

As for names and scopes, I got the basics down but I still am having trouble tracing the code we did in class. I need to work on that for next time.