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!

No comments:

Post a Comment