More o’ that concept stuff…

Posted on April 10, 2014

0


So today’s topic was “recursion” — and he walked us through really.  simple.   examples.   of it.   

I stumbled over recursion in my JavaScript class, when I wanted to display exponents and was googling for tips for putting that in, in animated form.   I’m curious as to how challenging my uniquely wired brain will find it to “think recursively.”   Our tip is to take whatever the Potentially Recursive Situation is, and break it down into the “base case” definition of the method and then the “recursive case ” definition. Thus, for “write a list of numbers,”   the base case is one number; the recursive case is a number plus a list.

     Factorials:   base case is that 1! = 1; recursive definition is N! == N * (N-1)!    He drew it up on the board, indenting each case in the example of 5!  so that you could see the “peeling off” of N each time.  

    Since I do this kind of thing all day, and … well, I do think about this kind of thign on bike rides… when he tossed up “5 x 4” and asked how that could be done recursively… it was obvious to me.   Base case:  N x 1 = N.   REcursion:  N  * d = N + N x (d-1)  .   

   So it progresses to “lab time,” and I try to wrestle with drawing rectangles.   I’m supposed to supply “left, top, right, bottom” as integers.  

    That was harder to figure out, with help, than our examples of recursion.   Have I mentioned I’m not a visual thinker? Even translated into “x and y of the two corners” was a little tough to grasp… but it meant I couldn’t take the quiz in class. However, it got quiet in the lab… and I got yet another 86.   I really did give things a second and third look, hoping to crack into the 90s… 

Advertisements
Posted in: Uncategorized