The first time I was introduced to anything recursive was during elementary school, when learning about the Fibonacci sequence. I was taught that the rule of this sequence was that the next number was found by finding the sum of the two numbers before it. Therefore, the result was always based on the previous result.
When learning about recursion in Computer Science, it seemed simple enough to understand mentally, but when it came to coding recursive functions, I could not wrap my head around it. I spent some time reading about recursion and looking at examples of recursive code, but I could not reproduce any myself. This was obviously going to be very detrimental to me, because I knew most of the code I would be looking at in the future would require me to know, understand, and implement recursion in order to write more effective code.
A solution I had for my struggle in understanding recursion was asking my friends and peers to tell me the simplest way they understood it. The best example I received was in the form of a present:
"There's this huge gift box, and inside it, there is another gift box, and inside it there is another gift box, and inside it, there is another gift box, etc. In order to get to the present, I'd have to open the first box, then open the next box, and then open the next box, etc.
To do this with a function, you would have the first gift box be your argument. You would check first if when you open the box, there isn't a box inside, because if it isn't a box, it would be your present. However, if there is a box inside, then you would call your function again, this time with the new box being the argument, and the same process would happen all over again, until you reach your present.
The action taken next would be based on the result of the previous action. Obviously if there was no next box inside, and you had reached your present, you would not try to open a box. The box wouldn't even exist for you to open it! In the same way, if you opened the box and there was another box inside, you wouldn't just stop and accept that this box is your true present."
This example really made me happy, not just because it involved a present, but because it took something I thought was complicated, and transformed it into a real life situation. I think it's important that I learned how to relate the troubles I have with functions to real life, because sometimes while searching for answers online, I find that they're convoluted in even bigger problems that I have not had experience with yet. This only serves to make me frustrated and disappointed in myself, taking away from the fun experience of Computer Science.
Hello, my name is Mel and I'm currently taking CSC 148. This is my blog, within which I will be documenting some of my progress throughout this course. Enjoy!
Thursday, 27 February 2014
Friday, 14 February 2014
"When it rains, it pours."
This is it; the week
that the first CSC148 assignment is due. Coincidentally, it is also the week of
multiple midterms, quizzes, essays, and assignments… right before Reading Week.
Talk about stressful.
I really think that
is the hardest part of university. I have never found any exams or tests to be
extremely difficult or challenging, but with all of them at once… it gets
difficult to focus on one thing when 5 others are at the back of your mind.
Both my partner and
I had a lot to worry about besides the due date of the assignment, and it was
quite difficult for us to juggle our time. It made us very sad and contemplate
if we still wanted to pursue Computer Science if we could not even handle an assignment.
With midterms worth 20% - 30% up till Wednesday night, getting frustrated over
fixing our assignment was not really a big priority.
That left Thursday;
the day my partner and I spent in the Help Center, just using the atmosphere as
an inspiration to work on our assignment. We would occasionally ask for help,
but really, the Help Center was a place that kept us from getting distracted as
much as we would have if we were elsewhere.
This week really
helped me realise the importance of time management, and how much I really need
to improve on mine. Had I started the assignment a bit earlier, or studied a
bit more for my midterms, I would have probably felt much better about my work
than I do presently.
Thursday, 6 February 2014
Operation "Move the Cheese"
For the first
assignment of CSC148, the objective was to implement parts of a step-by-step
design of an object-oriented program for a Towers of Anne Hoy game. Initially,
I felt like I didn't understand the game, so after some further reading on
Wikipedia, I realised it was a lot like the 4 Lions game I used to play on Math
Circus, (if anyone remembers that from elementary school).
I was a little bit
worried starting out on the assignment because I didn't feel too confident in
my abilities and knowledge to write and solve code. I read the assignment
handout repeatedly and stared at the files for hours, almost in tears because I
didn't even know how to begin. I never felt so clueless and flustered, and I
didn't even know what kind of questions to ask my peers without sounding like a
complete idiot.
After about 4 hours
of frustration, and a good night's rest, I managed to tackle the assignment
without too many difficulties.
The lesson I learned
from this experience was that even though I was reading the assignment over and
over again for hours, and not producing an visible progress, it doesn't mean
I'm still NOT making progress. I felt that understanding the assignment before
starting any work made the entire process much more easier to tackle, and
easier to fix, had I made any mistakes.
Subscribe to:
Posts (Atom)