Saturday, 7 February 2015
Week 5
This week we had our first midterm on the 4th. I think it went well. We only had one class and we covered implementation of some of the test cases in unittest and implementation of the bracket balancer. This week I'm supposed to write about my impressions of tracing recursion from week 4. I felt like tracing functions that are recursive not too hard. It's simply a matter of rewriting the function again whenever it's called. Writing a recursive function though is much harder. In our tutorial we had to write some recursive functions even though the focus was on stacks and queues. Queues, unlike stacks, are more like a lineup for coffee then a stack of papers. The first one in is the first one out unlike stack where the last one in is the first one out. Also methods for stack such as pop and push have different names for queues even though they pretty much do the same things except for with a queue. Enqueue puts an item at the front of the queue and dequeue returns and removes the last thing in the line. In our lab, one of our tasks was to create a function (one for stack and one for queue) that takes an input and adds it to the stack or queue and when 'end' is inputted, it removes and returns each element in the stack/queue. My partner and I were both successful. To wrap it up, recursion is fun to trace but not so much to do (unless you have a smart partner who knows what's up).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment