Skip to content

Lesson 13 · Python

Algorithms: Recursion & Divide-and-Conquer

Think in recursive calls and call-stack frames, read a recursion tree, and implement merge sort - then learn when a plain loop is the better tool.

Prerequisites: Algorithms: Searching & Sorting

Learning objectives
By the end of this lesson, you will be able to:
  • Trace recursive calls through the call stack, frame by frame
  • Write recursive functions with a base case and guaranteed progress
  • Read the recursion tree of naive fibonacci and explain its cost
  • Implement merge sort and state its divide-and-conquer structure
  • Decide when to convert recursion to a loop, using Python's recursion limit as a signal