Recursion’s Revenge

Cue the ominous tones recursion has returned (pun absolutely intended)! **ominous tones begin…**

So, Professor Riley ran through recursion in Thursday’s lecture (1/14/2016) and since a good number of you seemed to understand hw1b I think you all have a good outlook on how iteration works and more importantly, how it looks! Buuuuuut… as another example (and in my opinion, the easiest to see) here’s the Fibonacci series in its recursive form in Java (note the syntax and incrementing):

Screen Shot 2016-01-15 at 11.20.33 PM

And here’s it’s corresponding tree visualization (start thinking this way, it’ll make data structures a heck of a lot easier from here on out):

Screen Shot 2016-01-15 at 11.21.13 PM

Leave a Reply

Your email address will not be published. Required fields are marked *