In lecture today, recursion was continued, as well as a period for course evaluations.
The main recursion points covered were:
- additional math sequences & series defined recursively
- viewing arrays in a recursive way (head element, tail subarray)
- an overview of the relationship between loops and recursion
- thinking about what is going on behind the scenes in recursion when it is running
- thinking about whether recursion is simpler to read and write than other styles of problem solving
Here are the lecture notes.
Here is the recursive fibonacci program we looked at, and a trace (text file) of what it was outputting to the screen (which helps reveal how recursion worked behind the scenes).