Concept
A recursive function calls itself on a smaller input until a base case stops it. Each call sits on the call stack until it returns, which is why recursion that is too deep fails even when it is correct.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Base cases and the call stack doing its job.
def depth(node):
if node is None: # base case
return 0
return 1 + max(depth(node.left), depth(node.right))
def factorial(n):
return 1 if n <= 1 else n * factorial(n - 1)
import sys
sys.getrecursionlimit() # 1000 by defaultWriting the recursive case first and the base case as an afterthought, or on an input the recursion never reaches. Every call must move strictly toward a base case that returns without recursing.
Your roadmap puts these before Base cases and the call stack, unless you already know them.
Once a session shows you understand Base cases and the call stack, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Base cases and the call stack.