Problem Solving

Concept shape

Core
0
1
2
3
4
5
Definition

A recursive function solves a problem by calling itself on a smaller problem.

Step 1 / 5
Concept shape
Current lesson

Recursion Basics Lab

Problem Solving Core

Recursion Basics

Welcome to the Recursion Basics concept lab. A recursive function solves a problem by calling itself on a smaller problem. The must know points are: Every recursion needs a base case. Recursive calls use stack memory. Tree recursion can grow exponentially. The common operations are: base case, recursive case, combine result. The complexity shape is Depends on branching and depth. Watch out for these pitfalls: Missing base case. Not reducing the problem. Ignoring stack depth. Related algorithms include Tree Traversal, Merge Sort, Backtracking.

Concept details

A recursive function solves a problem by calling itself on a smaller problem.

Must know

  • Every recursion needs a base case.
  • Recursive calls use stack memory.
  • Tree recursion can grow exponentially.

Complexity

Depends on branching and depth

Open deeper visual structure lesson
1.0x