Saturday, February 7, 2015

Recursion, Retracing, and Regret (Week 5)

Hello fellow recursion-ists!

I'm going to be upfront about something here- I didn't go to class last week.

*Gasp!*

I know, I know. This was a bad bad idea, because of course, we learned something quite important last week and I unfortunately had to teach myself how to trace recursions. I'm afraid to say I wasn't very successful at it, because the concept still confuses me a bit.

What I'm most struck by with recursion is that there is something intuitively that feels wrong with referencing a method in its own definition- it feels like it should create an infinite loop. It took quite a bit of extremely outlined tracing before I understood why it didn't create an infinite loop- the if/else clause that breaks the loop when such a thing becomes necessary.

What I'm still a little struck by is why the professor seems to prefer recursion to the longer, but more straightforward, way of coding these programs. I think it'll take a while before I accept that this is better way to do things. But I think I do agree that it opens a world of possibilities.

Also, I'm wondering about the confining base case method of approaching recursion. Can we use recursion without a base case? How about in a for loop? How would that work? Wouldn't the 'return' statement in the base case cause the loop to remain unfinished?

In short, I am left with many questions about recursion and remain apprehensive about its worth- especially considering how confusing I find it.

((Also I will not be skipping any classes any time soon!))

So long, and thanks for all the fish!
- Anisha Rohra

No comments:

Post a Comment