Sunday, February 23, 2014

A1 featuring Cheese, Cheese and More Cheese


These past two weeks all I could think of was A1. Utilizing recursion to place cheese on different stools ensuring that a larger cheese doesn’t stack on top of a smaller one. This game is similar to he math circus game, where you had to order the lions largest to smallest and the smaller lions could not jump over the bigger ones.


(above is a picture of the math circus lion game)

Surprisingly the first couple of steps to the assignment were not that difficult. It was more about carefully reading the assignment to figure out where certain things where. The harder portion of the assignment was actually implementing the recursion. This portion involved a lot more thinking.

Personally, the portion with the recursion was very difficult for me. I was not really sure how the recursion worked. Throughout this assignment I was glad I took notes in class, they were helpful when I forgot how certain things worked. Another thing that I learned from this assignment is that for this upcoming test I really need to work on recursion.

More studying for me …..


Friday, February 7, 2014

Recursion Lab

This week we had a lab on recursion. Although a simple concept to grasp, I learned the hard way that everything needed to solve a problem is In the handout already.

The Lab that was done in class today was very straightforward. The first portion involved tracing functions. Within the lab we were given two functions two trace.  The first function was used to find the gcd (greatest common denominator) of two numbers. At first, I was a bit confused as to how tracing worked, after discussing it with my partner we ended up figuring it out. The second function was designed to figure out the binary number of the number give. After the first function, the second one was a lot easier to figure out.

The second portion of the lab was where we were expected, to write recursive code. The function that we were to write was meant to search a list for a number. The list itself had a bunch of specific specifications, things like how there were only three elements and how there could be a list as one of the elements. When my partner and I was writing our code we did not carefully keep track of all of the specific specifications that the list could have. As such, we could not figure out why we could not finish the lab.

After the lab was finished I felt foolish. However after looking through other SLOGS I noticed that I was not the only one with that problem (of reading the assignments carefully). People like Compcikitty and ddc also wrote about reading instructions carefully and understanding the instructiosn before coding. As such, I learned that everyone makes simple mistakes and sometimes we just need to take step back and take thing slowly, instead of getting all frustrated.  


This weeks lesson : Read everything carefully!

Sunday, February 2, 2014

Recursion

Recursion was the word of the week. Similar to mathematical induction, recursion is used when some base case is built upon to solve a problem. It is a simple concept to grasp.

Take for example a lecture hall filled with students. Although the number of students varies depending on the class, the way each assignment average changes the same way. If one student hands in his assignments then he will get marks for it and thus the course average will change. Taking that first student as our “base case” if we assume that the case holds true for some number of students, lets call this n, then through mathematical induction we can assume that it holds for n + 1 number of students. This means that it doesn’t matter how many students there is but when an assignment is handed in it affects the overall average in the same manner.

Although I am familiar with this idea of mathematical induction applying it for recursive problems in computer science is a bit more challenging. Coding for the base case is straightforward but I find it challenging to expand my knowledge and have it apply for all other cases. With the center of assignment one revolving around recursion, I am slightly worried. On the other hand, I accept the challenge that assignment one presents. As such, I hope to master recursion after the completion of this assignment.