[We hope that you can view the videos! However, if your internet connection is too slow for viewing videos, download the audio file (mp4) and the slides (pdf). Then you can listen to the audio as you go through the slides.]

More Recursion!

We continue our discussion on recursion. Here are the slides for all 3 videos of this lecture: pdf. The answers to the questions asked during this lecture are in a separate file at the end of this page.

Part 1: Call stack

We focus on what happens in memory when we execute a recursive function: the call stack grows with each recursive call, until a base case is reached and the call returns. All the calls eventually wrap up, accumulating the final result.

Part 2: More ways to divide (and conquer)

There are different ways to break up the problem into parts, but you need to make sure that each part will progress to the base case eventually and that the answers from the parts are combined correctly.

Part 3: Recursion and objects

Given a "family tree" represented using a Person objects, we write a function to determine the number of ancestors that a person has.

Answers to the first 4 questions asked during lecture: pdf