Archive for the ‘C++’ category

My Intro to Recursion

August 23rd, 2009

I haven’t studied recursion formally in a CS class yet, but, finding myself with a few free hours on a Sunday afternoon, I figured that I would dabble in this concept which seems to be pretty important stuff for CS dudes. I read the first few sections of a C++ book, and did a few online tutorials for the past few hours, and have managed to find myself here:

Now, after a solid mental go on my part, I was able to wrap my head around how the first function — printForward — was operating, but, for the life of me, I can not visualize how the second function — printBackword — was doing what it did. How the heck does that not just loop through itself without ever printing a number? Well, I guess for now, some frisbee in Golden Gate Park with the Pontz is how I will spend my evening … But this’ll keep itching some weird place in my head, waiting for me to come up with a (so-far) not-yet-comprehensible intuitive scratch.